Do not crash when trying to reverse an empty playlist

Fixes https://github.com/ncmpcpp/ncmpcpp/issues/616.
wilder
Andrzej Rybczak 1 year ago
parent 440e9a5768
commit 4fdafc5320
  1. 1
      CHANGELOG.md
  2. 5
      src/actions.cpp

@ -1,6 +1,7 @@
# ncmpcpp-0.10.1 (2024-??-??)
* Fix compilation with `libc++`.
* Remove `autogen.sh` in favour of `autoreconf`.
* Do not crash when trying to reverse an empty playlist.
# ncmpcpp-0.10 (2024-09-03)
* Add the configuration option `mpd_password`.

@ -1998,7 +1998,10 @@ bool ReversePlaylist::canBeRun()
return false;
m_begin = myPlaylist->main().begin();
m_end = myPlaylist->main().end();
return findSelectedRangeAndPrintInfoIfNot(m_begin, m_end);
if (m_begin == m_end)
return false;
else
return findSelectedRangeAndPrintInfoIfNot(m_begin, m_end);
}
void ReversePlaylist::run()

Loading…
Cancel
Save