Fix a crash when removing the active playlist when it is the first playlist. Fixes issue #1097

This commit is contained in:
David Sansome 2010-12-18 19:37:29 +00:00
parent f1f0a384a5
commit 85d1f16c5e
1 changed files with 9 additions and 1 deletions

View File

@ -165,7 +165,15 @@ void PlaylistManager::Remove(int 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_)
SetActivePlaylist(next_id);