From 809b99c9c95f6c9b5fd959e6dd39d21333773770 Mon Sep 17 00:00:00 2001 From: Kai DeLorenzo Date: Tue, 26 Nov 2024 16:00:13 -0500 Subject: [PATCH] fix null pointer exception --- .../fragment/mainactivity/main/VideoDetailView.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt index a3f403e6..8ec9c29b 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt @@ -1322,7 +1322,14 @@ class VideoDetailView : ConstraintLayout { this.video = video; cleanupPlaybackTracker(); - onVideoChanged.emit(video.video.videoSources[0].width, video.video.videoSources[0].height) + if (video.video.videoSources.isNotEmpty()) { + onVideoChanged.emit( + video.video.videoSources[0].width, + video.video.videoSources[0].height + ) + } else { + onVideoChanged.emit(0, 0) + } if (video is JSVideoDetails) { val me = this;