[Android] VideoPlayer: Prevent NPEs

Geoffrey Métais git at videolan.org
Fri Feb 1 13:34:42 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb  1 13:32:42 2019 +0100| [8f71228fc491fa70a56ceee9b3c732b943a9e684] | committer: Geoffrey Métais

VideoPlayer: Prevent NPEs

> https://code.videolan.org/videolan/vlc-android/commit/8f71228fc491fa70a56ceee9b3c732b943a9e684
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index f2b954fde..6e607883e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2089,7 +2089,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
     }
 
     public void doPlayPause() {
-        if (!mService.isPausable()) return;
+        if (mService == null || !mService.isPausable()) return;
         if (mService.isPlaying()) {
             showOverlayTimeout(OVERLAY_INFINITE);
             pause();
@@ -2306,7 +2306,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
 
             if(!mIsTv && !AndroidDevices.isChromeBook)
                 mOrientationToggle.setVisibility(View.VISIBLE);
-        } else if (mService != null) {
+        } else if (mService != null && mHudBinding != null) {
             mHudBinding.setProgress(mService.getPlaylistManager().getPlayer().getProgress());
             mHudBinding.setLifecycleOwner(this);
         }



More information about the Android mailing list