[Android] Prevent NPE for HDMI/screencast playback

Geoffrey Métais git at videolan.org
Thu Dec 24 00:46:53 CET 2015


vlc-android | branch: 1.7.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 24 00:46:30 2015 +0100| [3c73e7c9ad1149d9a3d883525ff25432de8b7d5c] | committer: Geoffrey Métais

Prevent NPE for HDMI/screencast playback

> https://code.videolan.org/videolan/vlc-android/commit/3c73e7c9ad1149d9a3d883525ff25432de8b7d5c
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 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 eb151fa..b2e551e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -737,7 +737,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mSurfacesAttached = true;
         vlcVout.addCallback(this);
         vlcVout.attachViews();
-        mRootView.setKeepScreenOn(true);
+        if (mRootView != null)
+            mRootView.setKeepScreenOn(true);
 
         loadMedia();
 
@@ -770,7 +771,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         vlcVout.removeCallback(this);
         if (mSurfacesAttached)
             vlcVout.detachViews();
-        mRootView.setKeepScreenOn(false);
+        if (mRootView != null)
+            mRootView.setKeepScreenOn(false);
 
         mHandler.removeCallbacksAndMessages(null);
 
@@ -2547,7 +2549,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      */
     private void play() {
         mService.play();
-        mRootView.setKeepScreenOn(true);
+        if (mRootView != null)
+            mRootView.setKeepScreenOn(true);
     }
 
     /**
@@ -2555,7 +2558,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      */
     private void pause() {
         mService.pause();
-        mRootView.setKeepScreenOn(false);
+        if (mRootView != null)
+            mRootView.setKeepScreenOn(false);
     }
 
     /*



More information about the Android mailing list