[Android] Enhance MediaWrapper comparison

Geoffrey Métais git at videolan.org
Mon Jun 13 15:16:56 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jun 13 15:09:11 2016 +0200| [81f9d7aa954cde9c650e6905d0c4ff8f26305c4c] | committer: Geoffrey Métais

Enhance MediaWrapper comparison

> https://code.videolan.org/videolan/vlc-android/commit/81f9d7aa954cde9c650e6905d0c4ff8f26305c4c
---

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

diff --git a/vlc-android/src/org/videolan/vlc/media/MediaWrapper.java b/vlc-android/src/org/videolan/vlc/media/MediaWrapper.java
index 5d406e5..b809500 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaWrapper.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaWrapper.java
@@ -113,9 +113,12 @@ public class MediaWrapper implements Parcelable {
 
     @Override
     public boolean equals(Object obj) {
-        if (mUri == ((MediaWrapper)obj).getUri())
+        Uri otherUri = ((MediaWrapper)obj).getUri();
+        if (mUri == null || otherUri == null)
+            return false;
+        if (mUri == otherUri)
             return true;
-        return false;
+        return mUri.equals(otherUri);
     }
 
     private void init(Media media) {



More information about the Android mailing list