fix(quick-14): add roll-back-on-failure to queue index advancement
- Next() rolls back currentIndex and skips emitIndexChanged on load failure - Previous() applies same pattern to all three branches (RepeatOne, restart, navigate) - OnPlaybackFinished() rolls back currentIndex on playCurrentTrack failure - PlayIndex() and playFromStart() also guard against load failures - RepeatOne paths guard emitIndexChanged with the bool return value
This commit is contained in:
@@ -12,8 +12,9 @@ func (q *Queue) OnPlaybackFinished() {
|
||||
|
||||
// Repeat One: replay the current track.
|
||||
if q.repeatMode == RepeatOne {
|
||||
q.playCurrentTrack()
|
||||
q.emitIndexChanged()
|
||||
if q.playCurrentTrack() {
|
||||
q.emitIndexChanged()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@@ -26,7 +27,14 @@ func (q *Queue) OnPlaybackFinished() {
|
||||
return
|
||||
}
|
||||
|
||||
prevIndex := q.currentIndex
|
||||
q.currentIndex = nextIdx
|
||||
q.playCurrentTrack()
|
||||
|
||||
if !q.playCurrentTrack() {
|
||||
q.currentIndex = prevIndex
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
q.emitIndexChanged()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user