don't crash with index out of range when removing radios from saved play queue

This commit is contained in:
Drew Weymouth
2024-06-02 08:46:07 -07:00
parent 8de689dee4
commit 0d848aecbd
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -36,6 +36,13 @@ func SavePlayQueue(serverID string, pm *PlaybackManager, filepath string, server
trackIDs = append(trackIDs, item.Metadata().ID)
}
}
if l := len(trackIDs); trackIdx >= l {
if l == 0 {
trackIdx = 0
} else {
trackIdx = l - 1
}
}
saved := serializedSavedPlayQueue{
ServerID: serverID,