mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
don't crash if imported entities make a reference to an unknown entity
This commit is contained in:
parent
94dfbc81f3
commit
1346ce22b9
1 changed files with 13 additions and 0 deletions
|
@ -1583,6 +1583,19 @@ QVector<EntityItemID> EntityTree::sendEntities(EntityEditPacketSender* packetSen
|
|||
});
|
||||
packetSender->releaseQueuedMessages();
|
||||
|
||||
// the values from map are used as the list of successfully "sent" entities. If some didn't actually make it,
|
||||
// pull them out. Bogus entries could happen if part of the imported data makes some reference to an entity
|
||||
// that isn't in the data being imported.
|
||||
QHash<EntityItemID, EntityItemID>::iterator i = map.begin();
|
||||
while (i != map.end()) {
|
||||
EntityItemID newID = i.value();
|
||||
if (localTree->findEntityByEntityItemID(newID)) {
|
||||
i++;
|
||||
} else {
|
||||
i = map.erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
return map.values().toVector();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue