From 2e31ab918ca0f3528a771e21b8c289f65c6a217c Mon Sep 17 00:00:00 2001 From: Ryan <73148864+Ryan-000@users.noreply.github.com> Date: Tue, 28 Apr 2026 16:20:55 -0400 Subject: [PATCH] Fix undo crash when animation editor is not active --- editor/animation/animation_blend_space_1d_editor.cpp | 8 ++++++-- editor/animation/animation_blend_space_2d_editor.cpp | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/editor/animation/animation_blend_space_1d_editor.cpp b/editor/animation/animation_blend_space_1d_editor.cpp index cf6c92f7b5..0d66bde5fa 100644 --- a/editor/animation/animation_blend_space_1d_editor.cpp +++ b/editor/animation/animation_blend_space_1d_editor.cpp @@ -408,7 +408,8 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() { } void AnimationNodeBlendSpace1DEditor::_update_space() { - if (updating) { + // edge case when undoing action after editor has changed + if (updating || blend_space.is_null()) { return; } @@ -587,7 +588,7 @@ void AnimationNodeBlendSpace1DEditor::_tool_switch(int p_tool) { } void AnimationNodeBlendSpace1DEditor::_update_edited_point_pos() { - if (updating) { + if (updating || blend_space.is_null()) { return; } @@ -716,6 +717,9 @@ void AnimationNodeBlendSpace1DEditor::_edit_point_index(double p_index) { void AnimationNodeBlendSpace1DEditor::_set_selected_point(int p_index) { selected_point = p_index; + if (blend_space.is_null()) { + return; + } _update_tool_erase(); if (p_index != -1) { _update_edited_point_pos(); diff --git a/editor/animation/animation_blend_space_2d_editor.cpp b/editor/animation/animation_blend_space_2d_editor.cpp index 530812a0be..13c05c495b 100644 --- a/editor/animation/animation_blend_space_2d_editor.cpp +++ b/editor/animation/animation_blend_space_2d_editor.cpp @@ -747,7 +747,7 @@ void AnimationNodeBlendSpace2DEditor::_snap_toggled() { } void AnimationNodeBlendSpace2DEditor::_update_space() { - if (updating) { + if (updating || blend_space.is_null()) { return; } @@ -891,7 +891,7 @@ void AnimationNodeBlendSpace2DEditor::_erase_selected() { } void AnimationNodeBlendSpace2DEditor::_update_edited_point_pos() { - if (updating) { + if (updating || blend_space.is_null()) { return; } @@ -968,6 +968,9 @@ void AnimationNodeBlendSpace2DEditor::_edit_point_index(double p_index) { void AnimationNodeBlendSpace2DEditor::_set_selected_point(int p_index) { selected_point = p_index; + if (blend_space.is_null()) { + return; + } _update_tool_erase(); if (p_index != -1) { _update_edited_point_pos();