mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 04:03:59 +02:00
fix crash for emtpy modelUrl in ModelEntityItem
This commit is contained in:
parent
c812798314
commit
d25f54485c
1 changed files with 11 additions and 6 deletions
|
@ -480,12 +480,17 @@ Model* RenderableModelEntityItem::getModel(EntityTreeRenderer* renderer) {
|
|||
} else { // we already have the model we want...
|
||||
result = _model;
|
||||
}
|
||||
} else { // if our desired URL is empty, we may need to delete our existing model
|
||||
if (_model) {
|
||||
_myRenderer->releaseModel(_model);
|
||||
result = _model = NULL;
|
||||
_needsInitialSimulation = true;
|
||||
}
|
||||
} else if (_model) {
|
||||
// remove from scene
|
||||
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
_model->removeFromScene(scene, pendingChanges);
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
|
||||
// release interest
|
||||
_myRenderer->releaseModel(_model);
|
||||
result = _model = NULL;
|
||||
_needsInitialSimulation = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue