[Android] PlaybackService: fix NPE

Thomas Guillem git at videolan.org
Mon Jul 6 10:37:55 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jul  6 10:31:01 2015 +0200| [b039f43f639acc94f39c065e299ae878a138be31] | committer: Thomas Guillem

PlaybackService: fix NPE

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b039f43f639acc94f39c065e299ae878a138be31
---

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

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 4146167..90821e3 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -698,10 +698,12 @@ public class PlaybackService extends Service {
         } else {
             final MediaPlayer.TrackDescription tracks[] = mMediaPlayer.getVideoTracks();
 
-            for (MediaPlayer.TrackDescription track : tracks) {
-                if (track.id != -1) {
-                    mMediaPlayer.setVideoTrack(track.id);
-                    break;
+            if (tracks != null) {
+                for (MediaPlayer.TrackDescription track : tracks) {
+                    if (track.id != -1) {
+                        mMediaPlayer.setVideoTrack(track.id);
+                        break;
+                    }
                 }
             }
         }



More information about the Android mailing list