[Android] MediaWrapper: set mLocation final (like before)

Thomas Guillem git at videolan.org
Fri Jan 23 13:01:18 CET 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 23 10:21:23 2015 +0100| [5bc46ca2a83e8c3bb5e4ddd3d1fb84cfd936b7d7] | committer: Thomas Guillem

MediaWrapper: set mLocation final (like before)

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

 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;



More information about the Android mailing list