1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +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,10 +29,8 @@ void ModelSelection::set(const ModelIndex& index)
void ModelSelection::add(const ModelIndex& index)
{
VERIFY(index.is_valid());
if (m_indices.contains(index))
return;
m_indices.set(index);
notify_selection_changed();
if (m_indices.set(index) == AK::HashSetResult::InsertedNewEntry)
notify_selection_changed();
}
void ModelSelection::add_all(const Vector<ModelIndex>& indices)