Skip to content

Commit

Permalink
Fix: Can't delete item in queue when queue is not active
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Nov 4, 2024
1 parent 0b78ba0 commit 07df754
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions music_assistant/controllers/player_queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def delete_item(self, queue_id: str, item_id_or_index: int | str) -> None:
else:
item_index = item_id_or_index
queue = self._queues[queue_id]
if item_index <= queue.index_in_buffer:
if queue.index_in_buffer is not None and item_index <= queue.index_in_buffer:
# ignore request if track already loaded in the buffer
# the frontend should guard so this is just in case
self.logger.warning("delete requested for item already loaded in buffer")
Expand Down Expand Up @@ -1485,7 +1485,7 @@ async def _check_clear_queue(self, queue: PlayerQueue) -> None:
return
if queue.next_item is not None:
return
if not (queue.current_index >= len(self._queue_items[queue.queue_id]) - 1):
if not ((queue.current_index or 0) >= len(self._queue_items[queue.queue_id]) - 1):
return
self.logger.info("End of queue reached, clearing items")
self.clear(queue.queue_id)
Expand Down

0 comments on commit 07df754

Please sign in to comment.