Skip to content

Commit

Permalink
fix queue manager (#81)
Browse files Browse the repository at this point in the history
fix queue manager to handle adding only one item before the current item
  • Loading branch information
shantanu-daisy authored Apr 11, 2024
1 parent 1e64a9a commit a574f94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/SwiftAudioEx/QueueManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class QueueManager<Element> {
throw AudioPlayerError.QueueError.invalidIndex(index: index, message: "Index to insert at has to be non-negative and equal to or smaller than the number of items: (\(items.count))")
}
// Correct index when items were inserted in front of it:
if (self.items.count > 1 && currentIndex >= index) {
if (self.items.count > 0 && currentIndex >= index) {
currentIndex += items.count
}
self.items.insert(contentsOf: items, at: index)
Expand Down

0 comments on commit a574f94

Please sign in to comment.