Fix typo in queue controller
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 17 Feb 2025 06:11:44 +0000 (07:11 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 17 Feb 2025 06:11:44 +0000 (07:11 +0100)
music_assistant/controllers/player_queues.py

index 653b6820fa334baea568bd892959f38ba61d553f..4e32a938148dc0c3930c02ef6c1fb1a08d526a88 100644 (file)
@@ -1040,15 +1040,22 @@ class PlayerQueuesController(CoreController):
                 # this also catches the case where they have an unavailable item in a listing
                 queue_item.media_item = await self.mass.music.get_item_by_uri(queue_item.uri)
             # ensure we got the original album set
-            if album and library_item.album and album.item_id != library_item.album.item_id:
-                if library_album := await self.mass.music.get_library_item_by_prov_id(
-                    album.media_type,
-                    album.item_id,
-                    album.provider,
-                ):
-                    queue_item.media_item.album = library_album
-                else:
-                    queue_item.media_item.album = album
+            if (
+                album
+                and library_item
+                and library_item.album
+                and album.item_id != library_item.album.item_id
+                and (
+                    library_album := await self.mass.music.get_library_item_by_prov_id(
+                        album.media_type,
+                        album.item_id,
+                        album.provider,
+                    )
+                )
+            ):
+                queue_item.media_item.album = library_album
+            else:
+                queue_item.media_item.album = album
         # Fetch the streamdetails, which could raise in case of an unplayable item.
         # For example, YT Music returns Radio Items that are not playable.
         queue_item.streamdetails = await get_stream_details(