From 951e9f0f26a1d4d16eaa6f42721b5680e1484207 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Mon, 20 Oct 2014 19:58:55 +0200 Subject: [PATCH] actions: delete stored playlists: fix infinite loop after deletion of empty playlist --- src/actions.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/actions.cpp b/src/actions.cpp index d743c58..270d52f 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -744,6 +744,10 @@ void DeleteStoredPlaylist::run() for (auto it = list.begin(); it != list.end(); ++it) Mpd.DeletePlaylist((*it)->value()); Statusbar::printf("%1% deleted", list.size() == 1 ? "Playlist" : "Playlists"); + // force playlists update. this happens automatically, but only after call + // to Key::read, therefore when we call PlaylistEditor::Update, it won't + // yet see it, so let's point that it needs to update it. + myPlaylistEditor->requestPlaylistsUpdate(); } else Statusbar::print("Aborted"); @@ -1814,7 +1818,8 @@ bool ClearPlaylist::canBeRun() const void ClearPlaylist::run() { - assert(!myPlaylistEditor->Playlists.empty()); + if (myPlaylistEditor->Playlists.empty()) + return; std::string playlist = myPlaylistEditor->Playlists.current().value(); bool yes = true; if (Config.ask_before_clearing_playlists) -- 2.11.4.GIT