Fix KeyError when retrieving full album object (#308)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 11 May 2022 20:38:07 +0000 (22:38 +0200)
committerGitHub <noreply@github.com>
Wed, 11 May 2022 20:38:07 +0000 (22:38 +0200)
music_assistant/controllers/music/albums.py

index 996c0be671a64bc58746f4c45c00a828fd2bd79a..3b3e7d09199b881bd23156cecafc3ec43e70151b 100644 (file)
@@ -32,9 +32,10 @@ class AlbumsController(MediaControllerBase[Album]):
         """Return (full) details for a single media item."""
         album = await super().get(*args, **kwargs)
         # append full artist details to full album item
-        album.artist = await self.mass.music.artists.get(
-            album.artist.item_id, album.artist.provider
-        )
+        if album.artist:
+            album.artist = await self.mass.music.artists.get(
+                album.artist.item_id, album.artist.provider
+            )
         return album
 
     async def tracks(self, item_id: str, provider_id: str) -> List[Track]: