Fix uninitialized metadata.images (#815)
authorJozef Kruszynski <60214390+jozefKruszynski@users.noreply.github.com>
Wed, 2 Aug 2023 14:00:16 +0000 (16:00 +0200)
committerGitHub <noreply@github.com>
Wed, 2 Aug 2023 14:00:16 +0000 (16:00 +0200)
Co-authored-by: jkruszynski <jozef@krush.at>
music_assistant/server/controllers/media/tracks.py

index 941b8f75983c9770f390333208c55df44e06b00b..ec251730e4518fc7184f1f7ba62eb00bd37e35fe 100644 (file)
@@ -169,6 +169,8 @@ class TracksController(MediaControllerBase[Track]):
             and item.album.image
             and item.album.album_type == AlbumType.SINGLE
         ):
+            if not item.metadata.images:
+                item.metadata.images = []
             item.metadata.images.append(item.album.image)
         # actually add (or update) the item in the library db
         # use the lock to prevent a race condition of the same item being added twice