Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
Check index before removing item
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterofbread committed Mar 18, 2024
1 parent 4ec2753 commit 47e036a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/commonMain/kotlin/cinterop/mpv/MpvClientImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ abstract class MpvClientImpl(headless: Boolean = true): LibMpvClient(headless) {
}

override fun removeItem(index: Int) {
require(index >= 0)
if (index !in 0 until item_count) {
return
}

val original_item_index: Int = current_item_index
runCommand("playlist-remove", index)
Expand Down

0 comments on commit 47e036a

Please sign in to comment.