[vlc-commits] macosx/library: don't try to show thumbnails for media where the generation failed

Felix Paul Kühne git at videolan.org
Wed Sep 25 19:41:54 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Fri Sep 20 12:53:52 2019 +0200| [026ad89189db9c9d7642f2175f9aeee742a618db] | committer: Felix Paul Kühne

macosx/library: don't try to show thumbnails for media where the generation failed

Just because the generation was started, does not mean it succeeded, so we cannot trust the state but need to check for the URL's validity.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=026ad89189db9c9d7642f2175f9aeee742a618db
---

 modules/gui/macosx/library/VLCLibraryDataTypes.h | 2 +-
 modules/gui/macosx/library/VLCLibraryDataTypes.m | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/gui/macosx/library/VLCLibraryDataTypes.h b/modules/gui/macosx/library/VLCLibraryDataTypes.h
index d168a618d5..d208f20ff6 100644
--- a/modules/gui/macosx/library/VLCLibraryDataTypes.h
+++ b/modules/gui/macosx/library/VLCLibraryDataTypes.h
@@ -169,7 +169,7 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
 @property (readonly) time_t lastPlayedDate;
 @property (readonly) NSString *title;
 
- at property (readonly) NSString *smallArtworkMRL;
+ at property (readonly, nullable) NSString *smallArtworkMRL;
 
 @property (readonly) BOOL smallArtworkGenerated;
 @property (readonly) BOOL favorited;
diff --git a/modules/gui/macosx/library/VLCLibraryDataTypes.m b/modules/gui/macosx/library/VLCLibraryDataTypes.m
index ea1ab16335..82fef465e0 100644
--- a/modules/gui/macosx/library/VLCLibraryDataTypes.m
+++ b/modules/gui/macosx/library/VLCLibraryDataTypes.m
@@ -295,8 +295,12 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
         _playCount = p_mediaItem->i_playcount;
         _lastPlayedDate = p_mediaItem->i_last_played_date;
         _title = toNSStr(p_mediaItem->psz_title);
-        _smallArtworkMRL = toNSStr(p_mediaItem->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl);
-        _smallArtworkGenerated = p_mediaItem->thumbnails[VLC_ML_THUMBNAIL_SMALL].b_generated;
+        _smallArtworkGenerated = p_mediaItem->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl != NULL;
+        if (_smallArtworkGenerated) {
+            _smallArtworkMRL = toNSStr(p_mediaItem->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl);
+        } else {
+            _smallArtworkMRL = nil;
+        }
         _favorited = p_mediaItem->b_is_favorite;
 
         switch (p_mediaItem->i_subtype) {



More information about the vlc-commits mailing list