Skip to content

Commit

Permalink
Entity tree: prevent creation of repeated entity items (#974)
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina authored Aug 16, 2021
1 parent 4a5a33d commit 7d1a3e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/gui/plugins/entity_tree/EntityTree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ void TreeModel::AddEntity(unsigned int _entity, const QString &_entityName,
return;
}

if (this->entityItems.find(_entity) != this->entityItems.end())
{
ignwarn << "Internal error: Trying to create item for entity [" << _entity
<< "], but entity already has an item." << std::endl;
return;
}

// New entity item
auto entityItem = new QStandardItem(_entityName);
entityItem->setData(_entityName, this->roleNames().key("entityName"));
Expand Down

0 comments on commit 7d1a3e0

Please sign in to comment.