[Android] Fix crash where MediaWrapper filename is null
Nicolas Pomepuy
git at videolan.org
Fri Jul 7 13:38:35 UTC 2023
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Jun 28 13:17:52 2023 +0200| [b147d901d308b53f4a9c9d40d487a1fe5af27142] | committer: Nicolas Pomepuy
Fix crash where MediaWrapper filename is null
Fixes #2977
> https://code.videolan.org/videolan/vlc-android/commit/b147d901d308b53f4a9c9d40d487a1fe5af27142
---
.../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 3ce4fca259..b53443c91e 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java
@@ -444,8 +444,11 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl
if (mFilename == null) {
if (mUri == null)
mFilename = "";
- else
+ else if (mUri.getLastPathSegment() != null) {
mFilename = mUri.getLastPathSegment();
+ } else {
+ mFilename = mUri.toString();
+ }
}
return mFilename;
}
More information about the Android
mailing list