[Android] Fix NullPointerException when a MediaWrapper uri is null

Nicolas Pomepuy git at videolan.org
Thu Sep 23 11:01:20 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Sep 21 08:05:36 2021 +0200| [3d0cf511ef5374b55197409bf947da6bda1b6b8d] | committer: Nicolas Pomepuy

Fix NullPointerException when a MediaWrapper uri is null

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

 .../src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java
index efabf2d6c..a9c9f04fd 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java
@@ -410,7 +410,10 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl
 
     public String getFileName() {
         if (mFilename == null) {
-            mFilename = mUri.getLastPathSegment();
+            if (mUri == null)
+                mFilename = "";
+            else
+                mFilename = mUri.getLastPathSegment();
         }
         return mFilename;
     }



More information about the Android mailing list