[Android] MediaWrapper: don't override good Meta with null

Thomas Guillem git at videolan.org
Tue May 31 17:49:53 CEST 2016


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue May 31 17:49:31 2016 +0200| [62478ea73275887f26b3ae80414b4c581f5951d8] | committer: Thomas Guillem

MediaWrapper: don't override good Meta with null

> https://code.videolan.org/videolan/vlc-android/commit/62478ea73275887f26b3ae80414b4c581f5951d8
---

 .../src/org/videolan/vlc/media/MediaWrapper.java   | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/MediaWrapper.java b/vlc-android/src/org/videolan/vlc/media/MediaWrapper.java
index 404de8b..e0f7bd1 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaWrapper.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaWrapper.java
@@ -231,26 +231,26 @@ public class MediaWrapper implements Parcelable {
         return mUri;
     }
 
-    private static String getMetaId(Media media, int id, boolean trim) {
+    private static String getMetaId(Media media, String defaultMeta, int id, boolean trim) {
         String meta = media.getMeta(id);
-        return meta != null ? trim ? meta.trim() : meta : null;
+        return meta != null ? trim ? meta.trim() : meta : defaultMeta;
     }
 
     public void updateMeta(Media media) {
-        mTitle = getMetaId(media, Meta.Title, true);
-        mArtist = getMetaId(media, Meta.Artist, true);
-        mAlbum = getMetaId(media, Meta.Album, true);
-        mGenre = getMetaId(media, Meta.Genre, true);
-        mAlbumArtist = getMetaId(media, Meta.AlbumArtist, true);
-        mArtworkURL = getMetaId(media, Meta.ArtworkURL, false);
-        mNowPlaying = getMetaId(media, Meta.NowPlaying, false);
-        final String trackNumber = getMetaId(media, Meta.TrackNumber, false);
+        mTitle = getMetaId(media, mTitle, Meta.Title, true);
+        mArtist = getMetaId(media, mArtist, Meta.Artist, true);
+        mAlbum = getMetaId(media, mAlbum, Meta.Album, true);
+        mGenre = getMetaId(media, mGenre, Meta.Genre, true);
+        mAlbumArtist = getMetaId(media, mAlbumArtist, Meta.AlbumArtist, true);
+        mArtworkURL = getMetaId(media, mArtworkURL, Meta.ArtworkURL, false);
+        mNowPlaying = getMetaId(media, mNowPlaying, Meta.NowPlaying, false);
+        final String trackNumber = getMetaId(media, null, Meta.TrackNumber, false);
         if (!TextUtils.isEmpty(trackNumber)) {
             try {
                 mTrackNumber = Integer.parseInt(trackNumber);
             } catch (NumberFormatException ignored) {}
         }
-        final String discNumber = getMetaId(media, Meta.DiscNumber, false);
+        final String discNumber = getMetaId(media, null, Meta.DiscNumber, false);
         if (!TextUtils.isEmpty(discNumber)) {
             try {
                 mDiscNumber = Integer.parseInt(discNumber);



More information about the Android mailing list