mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 04:57:23 +02:00
handling NULL pointer
This commit is contained in:
parent
7b74f7407a
commit
18390c87da
1 changed files with 8 additions and 2 deletions
|
@ -172,7 +172,10 @@ void OverlayPanel::applyTransformTo(Transform& transform, bool force) {
|
||||||
} else if (!_anchorPositionBindEntity.isNull()) {
|
} else if (!_anchorPositionBindEntity.isNull()) {
|
||||||
EntityTreePointer entityTree = DependencyManager::get<EntityScriptingInterface>()->getEntityTree();
|
EntityTreePointer entityTree = DependencyManager::get<EntityScriptingInterface>()->getEntityTree();
|
||||||
entityTree->withReadLock([&] {
|
entityTree->withReadLock([&] {
|
||||||
transform.setTranslation(entityTree->findEntityByID(_anchorPositionBindEntity)->getPosition());
|
EntityItemPointer foundEntity = entityTree->findEntityByID(_anchorPositionBindEntity);
|
||||||
|
if (foundEntity != NULL) {
|
||||||
|
transform.setTranslation(foundEntity->getPosition());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
transform.setTranslation(getAnchorPosition());
|
transform.setTranslation(getAnchorPosition());
|
||||||
|
@ -184,7 +187,10 @@ void OverlayPanel::applyTransformTo(Transform& transform, bool force) {
|
||||||
} else if (!_anchorRotationBindEntity.isNull()) {
|
} else if (!_anchorRotationBindEntity.isNull()) {
|
||||||
EntityTreePointer entityTree = DependencyManager::get<EntityScriptingInterface>()->getEntityTree();
|
EntityTreePointer entityTree = DependencyManager::get<EntityScriptingInterface>()->getEntityTree();
|
||||||
entityTree->withReadLock([&] {
|
entityTree->withReadLock([&] {
|
||||||
transform.setRotation(entityTree->findEntityByID(_anchorRotationBindEntity)->getRotation());
|
EntityItemPointer foundEntity = entityTree->findEntityByID(_anchorRotationBindEntity);
|
||||||
|
if (foundEntity != NULL) {
|
||||||
|
transform.setRotation(foundEntity->getRotation());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
transform.setRotation(getAnchorRotation());
|
transform.setRotation(getAnchorRotation());
|
||||||
|
|
Loading…
Reference in a new issue