1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 13:57:34 +00:00

LibGUI: Avoid double hash lookup in ModelSelection::add()

This commit is contained in:
Andreas Kling 2022-01-06 18:01:12 +01:00
parent 74311676cc
commit a433727961

View file

@ -29,9 +29,7 @@ void ModelSelection::set(const ModelIndex& index)
void ModelSelection::add(const ModelIndex& index) void ModelSelection::add(const ModelIndex& index)
{ {
VERIFY(index.is_valid()); VERIFY(index.is_valid());
if (m_indices.contains(index)) if (m_indices.set(index) == AK::HashSetResult::InsertedNewEntry)
return;
m_indices.set(index);
notify_selection_changed(); notify_selection_changed();
} }