[Android] ThumbnailsProvider: Prevent NPE

Geoffrey Métais git at videolan.org
Tue May 28 16:16:58 CEST 2019


vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 28 11:44:12 2019 +0200| [735f64e75d46a90e7c25134d21376ff4e8b963ab] | committer: Geoffrey Métais

ThumbnailsProvider: Prevent NPE

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

 vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java b/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java
index 7201d6b16..7aaadee0a 100644
--- a/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java
+++ b/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java
@@ -65,9 +65,11 @@ public class ThumbnailsProvider {
     @WorkerThread
     static Bitmap getVideoThumbnail(final MediaWrapper media, int width) {
         final String filePath = media.getUri().getPath();
+        if (filePath == null) return null;
         if (appDir == null) appDir = VLCApplication.getAppContext().getExternalFilesDir(null);
         final boolean hasCache = appDir != null && appDir.exists();
         final String thumbPath = getMediaCacheKey(true, media);
+        if (thumbPath == null) return null;
         final Bitmap cacheBM = hasCache ? BitmapCache.getInstance().getBitmapFromMemCache(thumbPath) : null;
         if (cacheBM != null) return cacheBM;
         if (hasCache && new File(thumbPath).exists()) return readCoverBitmap(thumbPath, width);



More information about the Android mailing list