[Android] Prevent NPE for unknown device
Geoffrey Métais
git at videolan.org
Wed Feb 18 16:07:44 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 18 14:57:41 2015 +0100| [7592242732eeb3c9cf2d0c51b20de4619add184e] | committer: Geoffrey Métais
Prevent NPE for unknown device
CID #1270883
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=7592242732eeb3c9cf2d0c51b20de4619add184e
---
.../videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
index 02373ab..dae8408 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
@@ -201,9 +201,12 @@ public class AudioPlayerActivity extends Activity implements AudioServiceControl
public boolean dispatchGenericMotionEvent(MotionEvent event){
- InputDevice mInputDevice = event.getDevice();
+ InputDevice inputDevice = event.getDevice();
- float x = AndroidDevices.getCenteredAxis(event, mInputDevice,
+ if (inputDevice == null)
+ return false;
+
+ float x = AndroidDevices.getCenteredAxis(event, inputDevice,
MotionEvent.AXIS_X);
if (System.currentTimeMillis() - mLastMove > JOYSTICK_INPUT_DELAY){
More information about the Android
mailing list