Do not crash when trying to reverse an empty playlist

Fixes https://github.com/ncmpcpp/ncmpcpp/issues/616.
This commit is contained in:
Andrzej Rybczak
2024-10-24 01:16:11 +02:00
parent 440e9a5768
commit 4fdafc5320
2 changed files with 5 additions and 1 deletions

View File

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

View File

@@ -1998,7 +1998,10 @@ bool ReversePlaylist::canBeRun()
return false; return false;
m_begin = myPlaylist->main().begin(); m_begin = myPlaylist->main().begin();
m_end = myPlaylist->main().end(); 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() void ReversePlaylist::run()