summaryrefslogtreecommitdiffstats
path: root/editor/editor_data.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2024-02-05 17:42:37 +0100
committerkobewi <kobewi4e@gmail.com>2024-02-05 17:42:37 +0100
commit808f4e8cb9be502060317526f887b1d31cbeb40a (patch)
tree4ee5041f68831353fe1f64be3f42e473e1eea78a /editor/editor_data.cpp
parentf427d2f0d35f27273e856871f8588652632d8ac2 (diff)
downloadredot-engine-808f4e8cb9be502060317526f887b1d31cbeb40a.tar.gz
Check if history exists before discarding
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r--editor/editor_data.cpp4
1 files changed, 3 insertions, 1 deletions
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);
}