[Android] Prevent NPE on key press in video player

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


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

Prevent NPE on key press in video player

(cherry picked from commit 9701271053aef8b798d0fd9cb2018c446e139f45)

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

 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 6dce46e77..56d56035b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1186,7 +1186,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