Fix exception with empty playlist
This commit is contained in:
parent
a74834af37
commit
47fde5cc74
|
@ -1029,7 +1029,7 @@
|
||||||
// - when the shuffle order changes. (TODO)
|
// - when the shuffle order changes. (TODO)
|
||||||
// - when the shuffle mode changes.
|
// - when the shuffle mode changes.
|
||||||
if (!_player) return;
|
if (!_player) return;
|
||||||
if (_audioSource && (_loopMode != loopOff || [_orderInv[_index] intValue] + 1 < [_order count])) {
|
if (_audioSource && (_loopMode != loopOff || ([_order count] > 0 && [_orderInv[_index] intValue] + 1 < [_order count]))) {
|
||||||
_player.actionAtItemEnd = AVPlayerActionAtItemEndAdvance;
|
_player.actionAtItemEnd = AVPlayerActionAtItemEndAdvance;
|
||||||
} else {
|
} else {
|
||||||
_player.actionAtItemEnd = AVPlayerActionAtItemEndPause; // AVPlayerActionAtItemEndNone
|
_player.actionAtItemEnd = AVPlayerActionAtItemEndPause; // AVPlayerActionAtItemEndNone
|
||||||
|
|
|
@ -339,7 +339,7 @@ class AudioPlayer {
|
||||||
shuffleModeEnabled == null) return null;
|
shuffleModeEnabled == null) return null;
|
||||||
if (loopMode == LoopMode.one) return currentIndex;
|
if (loopMode == LoopMode.one) return currentIndex;
|
||||||
final effectiveIndices = this.effectiveIndices;
|
final effectiveIndices = this.effectiveIndices;
|
||||||
if (effectiveIndices == null) return null;
|
if (effectiveIndices == null || effectiveIndices.isEmpty) return null;
|
||||||
final effectiveIndicesInv = _effectiveIndicesInv;
|
final effectiveIndicesInv = _effectiveIndicesInv;
|
||||||
final invPos = effectiveIndicesInv[currentIndex];
|
final invPos = effectiveIndicesInv[currentIndex];
|
||||||
var newInvPos = invPos + offset;
|
var newInvPos = invPos + offset;
|
||||||
|
|
Loading…
Reference in New Issue