Skip to content

Commit

Permalink
Fix seg fault due to invalid iterator to mutable_entities
Browse files Browse the repository at this point in the history
  • Loading branch information
mrushyendra committed Dec 16, 2020
1 parent 2f7f33d commit 17e79ac
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/EntityComponentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,15 @@ void EntityComponentManagerPrivate::SetRemovedComponentsMsgs(Entity &_entity,

// Find the entity in the message
auto entIter = _msg.mutable_entities()->find(_entity);
// Add the entity to the message, if not already added
if (entIter == _msg.mutable_entities()->end())
{
msgs::SerializedEntityMap ent;
ent.set_id(_entity);
entIter =
(_msg.mutable_entities())->insert({static_cast<uint64_t>(_entity), ent})
.first;
}

auto it = this->removedComponents.find(_entity);
for (uint64_t i = 0; i < nEntityKeys; ++i)
Expand Down

0 comments on commit 17e79ac

Please sign in to comment.