Fix a crash when removing the active playlist when it is the first playlist. Fixes issue #1097
This commit is contained in:
parent
f1f0a384a5
commit
85d1f16c5e
|
@ -165,7 +165,15 @@ void PlaylistManager::Remove(int id) {
|
||||||
|
|
||||||
playlist_backend_->RemovePlaylist(id);
|
playlist_backend_->RemovePlaylist(id);
|
||||||
|
|
||||||
int next_id = playlists_.constBegin()->p->id();
|
int next_id = -1;
|
||||||
|
foreach (int possible_next_id, playlists_.keys()) {
|
||||||
|
if (possible_next_id != id) {
|
||||||
|
next_id = possible_next_id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (next_id == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
if (id == active_)
|
if (id == active_)
|
||||||
SetActivePlaylist(next_id);
|
SetActivePlaylist(next_id);
|
||||||
|
|
Loading…
Reference in New Issue