[Android] Prevent NPE for HDMI/screencast playback

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


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 24 00:41:08 2015 +0100| [5494ef2d341dae3dcf48e9064bd652a14fab05a8] | committer: Geoffrey Métais

Prevent NPE for HDMI/screencast playback

> https://code.videolan.org/videolan/vlc-android/commit/5494ef2d341dae3dcf48e9064bd652a14fab05a8
---

 .../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 5a25a74..7730efb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -784,7 +784,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         if (mMediaRouter != null)
             mediaRouterAddCallback(true);
 
-        mRootView.setKeepScreenOn(true);
+        if (mRootView != null)
+            mRootView.setKeepScreenOn(true);
     }
 
     @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@@ -856,7 +857,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
     private void cleanUI() {
 
-        mRootView.setKeepScreenOn(false);
+        if (mRootView != null)
+            mRootView.setKeepScreenOn(false);
 
         if (mDetector != null) {
             mDetector.setOnDoubleTapListener(null);
@@ -2660,7 +2662,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      */
     private void play() {
         mService.play();
-        mRootView.setKeepScreenOn(true);
+        if (mRootView != null)
+            mRootView.setKeepScreenOn(true);
     }
 
     /**
@@ -2668,7 +2671,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