[UI] corrected segfault when enabling shuffle on en empty play queue

This commit is contained in:
emeric
2014-12-14 17:06:12 +01:00
parent a03a890f5b
commit d1c4678d82
+9 -4
View File
@@ -111,6 +111,7 @@ class TrackSelector
TrackSelector::TrackSelector() TrackSelector::TrackSelector()
: _loop(false), : _loop(false),
_shuffle(false), _shuffle(false),
_size(0),
_curPos(0) _curPos(0)
{ {
} }
@@ -152,10 +153,14 @@ TrackSelector::setShuffle(bool enable)
{ {
_shuffle = enable; _shuffle = enable;
if (_shuffle) if (_size != 0)
setPosByRowId(_curPos); {
else // Update the current index we are playing if we switch shuffle
setPos(_trackPos[_curPos]); if (_shuffle)
setPosByRowId(_curPos);
else
setPos(_trackPos[_curPos]);
}
} }
int int