mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 06:12:21 +02:00
Merge pull request #9555 from huffman/fix/entity-is-child-of-crash
Fix Entities.isChildOfParent crashing if given unknown ID
This commit is contained in:
commit
5287c94786
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