summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRelintai <relintai@gmail.com>2019-10-03 20:42:22 +0200
committerRelintai <relintai@gmail.com>2019-10-03 21:07:49 +0200
commitc39490cf79dab5ba56c52e574d0edfb59930755b (patch)
tree37101063cd3bb8ae29eb7ae40293d685f7de5bca /editor
parentd86c9ef2e691ced51175136b42a9cce2a8c54227 (diff)
Fix potential crash in AnimationPlayer.
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 75a7099ec4..80353bab01 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -484,6 +484,8 @@ double AnimationPlayerEditor::_get_editor_step() const {
if (track_editor->is_snap_enabled()) {
const String current = player->get_assigned_animation();
const Ref<Animation> anim = player->get_animation(current);
+ ERR_FAIL_COND_V(!anim.is_valid(), 0.0);
+
// Use more precise snapping when holding Shift
return Input::get_singleton()->is_key_pressed(KEY_SHIFT) ? anim->get_step() * 0.25 : anim->get_step();
}