actions: fix playlist cropping when no item is selected

This commit is contained in:
Andrzej Rybczak
2014-09-03 22:58:49 +02:00
parent 9238008033
commit c1c47bdfc4

View File

@@ -1734,7 +1734,11 @@ void CropMainPlaylist::run()
if (yes)
{
Statusbar::print("Cropping playlist...");
cropPlaylist(myPlaylist->main(), boost::bind(&MPD::Connection::Delete, _1, _2));
auto &w = myPlaylist->main();
// if no item is selected, select the current one
if (!w.empty() && !hasSelected(w.begin(), w.end()))
w.current().setSelected(true);
cropPlaylist(w, boost::bind(&MPD::Connection::Delete, _1, _2));
}
}