Prevent crash if a node was removed during path traversal (closes #1990)

Show an error message, because this is bad user behavior and should be discouraged :)
This commit is contained in:
Emma Broman
2022-04-13 16:47:16 +02:00
parent bd0de385ba
commit 80d3efd64c

View File

@@ -205,6 +205,16 @@ void PathNavigator::updateCamera(double deltaTime) {
return;
}
if (!_currentPath->startPoint().node() || !_currentPath->endPoint().node()) {
LERROR(
"One of the scene graph nodes used in an active camera path "
"was removed. Aborting path"
);
abortPath();
global::navigationHandler->orbitalNavigator().setFocusNode("Root", false);
return;
}
// Prevent long delta times due to e.g. computations from other actions to cause
// really big jumps in the motion along the path
// OBS! Causes problems if the general FPS is lower than 10, but then the user should