diff --git a/NEWS b/NEWS index d132ef1b..28a4b439 100644 --- a/NEWS +++ b/NEWS @@ -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. diff --git a/src/helpers.h b/src/helpers.h index 19d66b53..c4e5123e 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -35,6 +35,11 @@ template 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);