add guard
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 18 Apr 2024 22:21:57 +0000 (00:21 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 18 Apr 2024 22:21:57 +0000 (00:21 +0200)
music_assistant/common/models/media_items.py

index 407d58f4ecdcd387ea5abe0ebc3c693198f0afa3..ba294055eb6215ce72cef345902ab87c37f7fcd0 100644 (file)
@@ -346,7 +346,9 @@ class ItemMapping(_MediaItemBase):
                     continue
                 thumb_image = img
                 break
-        return cls.from_dict({**item.to_dict(), "image": thumb_image.to_dict()})
+        return cls.from_dict(
+            {**item.to_dict(), "image": thumb_image.to_dict() if thumb_image else None}
+        )
 
 
 @dataclass(kw_only=True)