When importing entities from JSON: fixed a null pointer exception if addEntity() failed on any of the entities

This commit is contained in:
Oren Hurvitz 2018-04-17 12:32:28 +03:00
parent 4c0a0a84fa
commit 91e27db9b0

View file

@ -2282,7 +2282,10 @@ bool EntityTree::sendEntitiesOperation(const OctreeElementPointer& element, void
if (args->otherTree) {
args->otherTree->withWriteLock([&] {
EntityItemPointer entity = args->otherTree->addEntity(newID, properties);
entity->deserializeActions();
if (entity) {
entity->deserializeActions();
}
// else: there was an error adding this entity
});
}
return newID;