From 808f4e8cb9be502060317526f887b1d31cbeb40a Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 5 Feb 2024 17:42:37 +0100 Subject: Check if history exists before discarding --- editor/editor_data.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'editor/editor_data.cpp') diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 786e841c21..b4cf6d8de1 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -649,7 +649,9 @@ void EditorData::remove_scene(int p_idx) { EditorNode::get_singleton()->emit_signal("scene_closed", edited_scene[p_idx].path); } - undo_redo_manager->discard_history(edited_scene[p_idx].history_id); + if (undo_redo_manager->has_history(edited_scene[p_idx].history_id)) { // Might not exist if scene failed to load. + undo_redo_manager->discard_history(edited_scene[p_idx].history_id); + } edited_scene.remove_at(p_idx); } -- cgit v1.2.3