Fix crash occuring when searching backward in an empty list

master
Andrzej Rybczak 10 years ago
parent 0465962409
commit e657089b30
  1. 1
      NEWS
  2. 5
      src/helpers.h

@ -2,6 +2,7 @@ ncmpcpp-0.7.5 (????-??-??)
* Action chains can be now used for seeking.
* Fixed fetching artist info from last.fm.
* Default value of regular_expressions was changed from 'basic' to 'perl' to work around boost issue (#12222).
* Fixed crash occuring when searching backward in an empty list.
ncmpcpp 0.7.4 (2016-04-17)
* Fetching lyrics from lyricwiki.org was fixed.

@ -35,6 +35,11 @@ template <typename Iterator, typename PredicateT>
Iterator wrappedSearch(Iterator begin, Iterator current, Iterator end,
const PredicateT &pred, bool wrap, bool skip_current)
{
if (begin == end)
{
assert(current == end);
return begin;
}
if (skip_current)
++current;
auto it = std::find_if(current, end, pred);

Loading…
Cancel
Save