[Android] Enhance MediaWrapper comparison

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


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

Enhance MediaWrapper comparison

(cherry picked from commit 81f9d7aa954cde9c650e6905d0c4ff8f26305c4c)

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

 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