mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-24 09:39:57 +02:00
Fix Entities.isChildOfParent crashing if given unknown ID
If an entity was not in the local tree a null deref crash would occur. This commit makes sure the entity pointer is checked for null before it is used.
This commit is contained in:
parent
ae8d0d1948
commit
e58c9326a0
1 changed files with 8 additions and 6 deletions
|
@ -1366,12 +1366,14 @@ bool EntityScriptingInterface::isChildOfParent(QUuid childID, QUuid parentID) {
|
|||
|
||||
_entityTree->withReadLock([&] {
|
||||
EntityItemPointer parent = _entityTree->findEntityByEntityItemID(parentID);
|
||||
parent->forEachDescendant([&](SpatiallyNestablePointer descendant) {
|
||||
if(descendant->getID() == childID) {
|
||||
isChild = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (parent) {
|
||||
parent->forEachDescendant([&](SpatiallyNestablePointer descendant) {
|
||||
if (descendant->getID() == childID) {
|
||||
isChild = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return isChild;
|
||||
|
|
Loading…
Reference in a new issue