[Android] Prevent NPE

Nicolas Pomepuy git at videolan.org
Wed Sep 2 09:41:28 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Sep  1 10:13:56 2020 +0200| [622afd77387d6e6516978a7bc1a2cefbf4d17428] | committer: Nicolas Pomepuy

Prevent NPE

> https://code.videolan.org/videolan/vlc-android/commit/622afd77387d6e6516978a7bc1a2cefbf4d17428
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt           | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index b5b74ba0c..c4310b00e 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -2005,7 +2005,11 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
                     }
                 }
                 val interactive = service?.mediaplayer?.let {
-                    (it.titles[it.title])?.isInteractive ?: false
+                    try {
+                        (it.titles[it.title])?.isInteractive ?: false
+                    } catch (e: NullPointerException) {
+                        false
+                    }
                 } ?: false
                 isNavMenu = menuIdx == currentIdx || interactive
             }



More information about the Android mailing list