summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorFlorian Kothmeier <floriankothmeier@web.de>2021-01-05 15:56:06 +0100
committerFlorian Kothmeier <floriankothmeier@web.de>2021-01-06 13:04:27 +0100
commitb6e7df56cbf93a0ecdc3bec05adcbdd08a16701b (patch)
treecc3a8d90f44941d3d90fa9b8bcf23fb7a55d69b5 /scene
parentc5ff2cb3d9bca0478e3abce7540e3b831fa5ef37 (diff)
Fix AnimationNodeStateMachinePlayback start() on nonexistent node
Diffstat (limited to 'scene')
-rw-r--r--scene/animation/animation_node_state_machine.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index ef9f531f04..a3af07a238 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -334,11 +334,17 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_st
}
} else {
// teleport to start
- path.clear();
- current = start_request;
- playing = true;
- play_start = true;
- start_request = StringName(); //clear start request
+ if (p_state_machine->states.has(start_request)) {
+ path.clear();
+ current = start_request;
+ playing = true;
+ play_start = true;
+ start_request = StringName(); //clear start request
+ } else {
+ StringName node = start_request;
+ start_request = StringName(); //clear start request
+ ERR_FAIL_V_MSG(0, "No such node: '" + node + "'");
+ }
}
}