[Android] Prevent NPE

Geoffrey Métais git at videolan.org
Mon Mar 14 12:29:05 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 14 10:18:29 2016 +0100| [42c3468ad99b2daf16211ee4fbbe4f93ee0a9fbb] | committer: Geoffrey Métais

Prevent NPE

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index e238f72..9acf1ba 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -488,8 +488,10 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
             } else if (action.equalsIgnoreCase(ACTION_REMOTE_LAST_VIDEO_PLAYLIST)) {
                 loadLastPlaylist(TYPE_VIDEO);
             } else if (action.equalsIgnoreCase(ACTION_REMOTE_SWITCH_VIDEO)) {
-                getCurrentMediaWrapper().removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
-                switchToVideo();
+                if (hasMedia()) {
+                    getCurrentMediaWrapper().removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
+                    switchToVideo();
+                }
             } else if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_INIT)) {
                 updateWidget();
             }



More information about the Android mailing list