[Android] Prevent NPE on key press in video player

Geoffrey Métais git at videolan.org
Wed Nov 29 10:06:31 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Nov 29 10:04:14 2017 +0100| [9701271053aef8b798d0fd9cb2018c446e139f45] | committer: Geoffrey Métais

Prevent NPE on key press in video player

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 2 +-
 1 file changed, 1 insertion(+), 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 ef38fe3ff..7e165bc0b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1159,7 +1159,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
-        if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_BUTTON_B)
+        if (mService == null || keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_BUTTON_B)
             return super.onKeyDown(keyCode, event);
         if (mPlaybackSetting != DelayState.OFF)
             return false;



More information about the Android mailing list