[Android] [PATCH 1/3] MediaWrapper: set mLocation final (like before)

Thomas Guillem thomas at gllm.fr
Fri Jan 23 10:41:03 CET 2015


---
 vlc-android/src/org/videolan/vlc/MediaWrapper.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapper.java b/vlc-android/src/org/videolan/vlc/MediaWrapper.java
index 7d92424..d8f8f90 100644
--- a/vlc-android/src/org/videolan/vlc/MediaWrapper.java
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapper.java
@@ -61,7 +61,7 @@ public class MediaWrapper implements Parcelable {
     private String mTrackID;
     private String mArtworkURL;
 
-    private String mLocation;
+    private final String mLocation;
     private String mFilename;
     private long mTime = 0;
     private int mAudioTrack = -1;
@@ -87,20 +87,24 @@ public class MediaWrapper implements Parcelable {
         final Media media = new Media(libVLC, mrl);
         media.parse();
         media.release();
+        mLocation = media.getMrl();
         init(media);
     }
 
     /**
      * Create a new MediaWrapper
-     * @param media should be parsed
+     * @param media should be parsed and not NULL
      */
     public MediaWrapper(Media media) {
+        if (media == null)
+            throw new NullPointerException("media was null");
+
+        mLocation = media.getMrl();
         init(media);
     }
 
     private void init(Media media) {
 
-        mLocation = media.getMrl();
         mLength = media.getDuration();
 
         mType = TYPE_ALL;
-- 
2.1.3



More information about the Android mailing list