[Android] Proper crash fix for the NullPointerException triggered by a race condition

Nicolas Pomepuy git at videolan.org
Fri Oct 15 08:52:20 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Oct 13 08:21:44 2021 +0200| [e42fa88be78815db512f117764896579679de889] | committer: Nicolas Pomepuy

Proper crash fix for the NullPointerException triggered by a race condition

The fix made in 65cac21c985220222d1ee67934a9fea72ea90ca1
was not working because MediaWrapperImpl was overriding the
getTitle method. The useless override has been removed

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

 .../videolan/medialibrary/media/MediaWrapperImpl.java    | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapperImpl.java b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapperImpl.java
index a1b5d83bc..26bc1bcb9 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapperImpl.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapperImpl.java
@@ -25,7 +25,6 @@ package org.videolan.medialibrary.media;
 import android.graphics.Bitmap;
 import android.net.Uri;
 import android.os.Parcel;
-import android.text.TextUtils;
 
 import org.videolan.libvlc.interfaces.IMedia;
 import org.videolan.medialibrary.Tools;
@@ -78,21 +77,6 @@ public class MediaWrapperImpl extends MediaWrapper {
         mArtist = artist;
     }
 
-    @Override
-    public String getTitle() {
-        if (!TextUtils.isEmpty(mDisplayTitle))
-            return mDisplayTitle;
-        if (!TextUtils.isEmpty(mTitle))
-            return mTitle;
-        String fileName = getFileName();
-        if (fileName == null)
-            return "";
-        int end = fileName.lastIndexOf(".");
-        if (end <= 0)
-            return fileName;
-        return fileName.substring(0, end);
-    }
-
     public String getReferenceArtist() {
         return mAlbumArtist == null ? mArtist : mAlbumArtist;
     }



More information about the Android mailing list