From 37d8da11774c6eff3d1c2902ac883dace178e832 Mon Sep 17 00:00:00 2001 From: Nicolas Frenay Date: Mon, 1 Apr 2024 01:04:45 -0300 Subject: [PATCH] fix #461: No playlist on psst-gui and failed to read json error (#464) Makes playlist images an optional Vector. --- psst-gui/src/data/playlist.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/psst-gui/src/data/playlist.rs b/psst-gui/src/data/playlist.rs index 61e9d7bf..c96f5624 100644 --- a/psst-gui/src/data/playlist.rs +++ b/psst-gui/src/data/playlist.rs @@ -27,7 +27,8 @@ pub struct PlaylistRemoveTrack { pub struct Playlist { pub id: Arc, pub name: Arc, - pub images: Vector, + #[serde(skip_serializing_if="Option::is_none")] + pub images: Option>, pub description: Arc, #[serde(rename = "tracks")] #[serde(deserialize_with = "deserialize_track_count")] @@ -45,7 +46,9 @@ impl Playlist { } pub fn image(&self, width: f64, height: f64) -> Option<&Image> { - Image::at_least_of_size(&self.images, width, height) + self.images.as_ref().and_then(|images| { + Image::at_least_of_size(images, width, height) + }) } pub fn url(&self) -> String {