[Android] Prevent NPE

Geoffrey Métais git at videolan.org
Wed Mar 1 08:51:24 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar  1 08:48:38 2017 +0100| [35ee6697465e5f4698b8b897a5975360328b0ba3] | committer: Geoffrey Métais

Prevent NPE

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

 .../org/videolan/vlc/gui/video/VideoPlayerActivity.java   | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 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 3bb271e..edd4b23 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1376,13 +1376,18 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             sb.show();
         }
         mPlaybackSetting = DelayState.OFF;
-        mPlaybackSettingMinus.setOnClickListener(null);
-        mPlaybackSettingPlus.setOnClickListener(null);
-        mPlaybackSettingMinus.setVisibility(View.INVISIBLE);
-        mPlaybackSettingPlus.setVisibility(View.INVISIBLE);
+        if (mPlaybackSettingMinus != null) {
+            mPlaybackSettingMinus.setOnClickListener(null);
+            mPlaybackSettingMinus.setVisibility(View.INVISIBLE);
+        }
+        if (mPlaybackSettingPlus != null) {
+            mPlaybackSettingPlus.setOnClickListener(null);
+            mPlaybackSettingPlus.setVisibility(View.INVISIBLE);
+        }
         UiTools.setViewVisibility(mOverlayInfo, View.INVISIBLE);
         mInfo.setText("");
-        mPlayPause.requestFocus();
+        if (mPlayPause != null)
+            mPlayPause.requestFocus();
     }
 
     public void delayAudio(long delta){



More information about the Android mailing list