don't crash with index out of range when removing radios from saved play queue
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user