Fix coverity issues

This commit is contained in:
heckflosse 2018-11-20 21:23:37 +01:00
parent a19f3484dd
commit e7a04bb77e

View File

@ -176,25 +176,29 @@ void ThumbBrowserBase::selectRange (ThumbBrowserEntryBase* clicked, bool additio
ThumbIterator front = std::find(fd.begin(), fd.end(), selected.front());
ThumbIterator current = std::find(fd.begin(), fd.end(), clicked);
if (front > current)
if (front > current) {
std::swap(front, current);
}
clearSelection(selected);
for (; front <= current; ++front)
for (; front <= current && front != fd.end(); ++front) {
addToSelection(*front, selected);
}
} else {
// Add an additional range w.r.t. the last clicked entry.
ThumbIterator last = std::find(fd.begin(), fd.end(), lastClicked);
ThumbIterator current = std::find (fd.begin(), fd.end(), clicked);
if (last > current)
if (last > current) {
std::swap(last, current);
}
for (; last <= current; ++last)
for (; last <= current && last != fd.end(); ++last) {
addToSelection(*last, selected);
}
}
}
void ThumbBrowserBase::selectSet (ThumbBrowserEntryBase* clicked)
{
@ -337,7 +341,7 @@ void ThumbBrowserBase::selectNext (int distance, bool enlarge)
std::swap(front, back);
}
for (; front <= back; ++front) {
for (; front <= back && front != fd.end(); ++front) {
if (!(*front)->filtered) {
(*front)->selected = true;
redrawNeeded (*front);