[Android] MWL: avoid NPE if MediaWrapper is null

Jean-Baptiste Kempf git at videolan.org
Thu Jun 11 21:42:44 CEST 2015


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Jun 11 21:26:56 2015 +0200| [22ea4ce564fdb1b1f1c8d3c570e81c46f0e74f9d] | committer: Jean-Baptiste Kempf

MWL: avoid NPE if MediaWrapper is null

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

 vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java b/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java
index 345d123..324d6fa 100644
--- a/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java
@@ -64,10 +64,12 @@ public class MediaWrapperListPlayer {
         if (mrl == null)
             return;
         final MediaWrapper mw = mMediaList.getMedia(position);
+        if (mw == null)
+            return;
         mPlayerIndex = position;
 
         final Media media = new Media(VLCInstance.get(), mw.getUri());
-        VLCOptions.setMediaOptions(media, context, flags | (mw != null ? mw.getFlags() : 0));
+        VLCOptions.setMediaOptions(media, context, flags | mw.getFlags());
         VLCInstance.getMainMediaPlayer().setMedia(media);
         media.release();
         VLCInstance.getMainMediaPlayer().setEqualizer(VLCOptions.getEqualizer());



More information about the Android mailing list