[Android] Prevent setting the non-indexed media artworkUrl that is not saved on disk

Nicolas Pomepuy git at videolan.org
Thu Sep 8 05:47:23 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Sep  6 08:28:49 2022 +0200| [8dad40500b285bebbd6485f9005ffc54d1986fe4] | committer: Nicolas Pomepuy

Prevent setting the non-indexed media artworkUrl that is not saved on disk

If the cache is cleared in the meantime, the app will only try to retrieve the
artworkUrl file that is not existing and then fail
Fixes #2600

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

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

diff --git a/application/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt b/application/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt
index 63399d5db..47c9f1e9e 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.kt
@@ -95,8 +95,10 @@ object ThumbnailsProvider {
             BitmapCache.addBitmapToMemCache(getMediaCacheKey(true, media, width.toString()), bitmap)
             if (hasCache) {
                 media.setThumbnail(thumbPath)
-                if (media.id > 0) BitmapUtil.saveOnDisk(bitmap, thumbPath)
-                media.artworkURL = thumbPath
+                if (media.id > 0) {
+                    BitmapUtil.saveOnDisk(bitmap, thumbPath)
+                    media.artworkURL = thumbPath
+                }
             }
         } else if (media.id != 0L) {
             media.requestThumbnail(width, 0.4f)



More information about the Android mailing list