Skip to content

Commit

Permalink
fix: iterator out of bounds for dciicon
Browse files Browse the repository at this point in the history
Add check.

pms: TASK-368399
  • Loading branch information
18202781743 committed Dec 26, 2024
1 parent b152721 commit cc0f8eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/util/ddciicon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ void DDciIconPrivate::loadIconList()
node.entries << icon;
node.maxPaddings = qMax(node.maxPaddings, icon->maxPaddings);
}
if (node.entries.isEmpty())
continue;
icons << std::move(node);
}
}
Expand Down Expand Up @@ -646,7 +648,7 @@ DDciIconEntry *DDciIconPrivate::tryMatchIcon(int iconSize, DDciIcon::Theme theme
}

const auto targetIcon = std::max_element(iconWeight.constBegin(), iconWeight.constEnd());
if (*targetIcon > 0)
if (targetIcon != iconWeight.constEnd() && *targetIcon > 0)
return listOfSize.entries.at(targetIcon - iconWeight.constBegin());
return nullptr;
}
Expand Down

0 comments on commit cc0f8eb

Please sign in to comment.