Fix TypeError in queue controller
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 21 May 2025 00:07:31 +0000 (02:07 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 21 May 2025 00:07:31 +0000 (02:07 +0200)
music_assistant/controllers/player_queues.py

index 04a41655a08c02052568e301d77efed1a69c2f05..e127309b477a197399bcc6b54b0cf6f1c99e0e44 100644 (file)
@@ -1208,7 +1208,7 @@ class PlayerQueuesController(CoreController):
         # without having to compare the entire list
         queue.items_last_updated = time.time()
         self.signal_update(queue_id, True)
-        if queue.state == PlayerState.PLAYING:
+        if queue.state == PlayerState.PLAYING and queue.index_in_buffer is not None:
             # if the queue is playing,
             # ensure to (re)queue the next track because it might have changed
             if next_item := self.get_next_item(queue_id, queue.index_in_buffer):
@@ -1491,7 +1491,7 @@ class PlayerQueuesController(CoreController):
         # all other: just the next index
         return cur_index + 1
 
-    def get_next_item(self, queue_id: str, cur_index: int | str | None = None) -> QueueItem | None:
+    def get_next_item(self, queue_id: str, cur_index: int | str) -> QueueItem | None:
         """Return next QueueItem for given queue."""
         if isinstance(cur_index, str):
             cur_index = self.index_by_id(queue_id, cur_index)