[Android] VideoPlayerActivity prevent NPE on switch to popup

Geoffrey Métais git at videolan.org
Tue Oct 3 12:06:37 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct  3 10:13:13 2017 +0200| [b8eda50524cdaaacfeab29192911738c21c6cb9e] | committer: Geoffrey Métais

VideoPlayerActivity prevent NPE on switch to popup

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

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

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 7520ae528..715fa3c3e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -601,8 +601,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             if (Permissions.canDrawOverlays(this)) {
                 mSwitchingView = true;
                 mSwitchToPopup = true;
+                final MediaWrapper mw = mService.getCurrentMediaWrapper();
+                if (mw == null)
+                    return;
                 if (mService != null && !mService.isPlaying())
-                    mService.getCurrentMediaWrapper().addFlags(MediaWrapper.MEDIA_PAUSED);
+                    mw.addFlags(MediaWrapper.MEDIA_PAUSED);
                 cleanUI();
                 exitOK();
             } else



More information about the Android mailing list