Check if history exists before discarding
This commit is contained in:
parent
f427d2f0d3
commit
808f4e8cb9
|
@ -649,7 +649,9 @@ void EditorData::remove_scene(int p_idx) {
|
|||
EditorNode::get_singleton()->emit_signal("scene_closed", edited_scene[p_idx].path);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -375,6 +375,10 @@ bool EditorUndoRedoManager::has_redo() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool EditorUndoRedoManager::has_history(int p_idx) const {
|
||||
return history_map.has(p_idx);
|
||||
}
|
||||
|
||||
void EditorUndoRedoManager::clear_history(bool p_increase_version, int p_idx) {
|
||||
if (p_idx != INVALID_HISTORY) {
|
||||
History &history = get_or_create_history(p_idx);
|
||||
|
|
|
@ -130,6 +130,7 @@ public:
|
|||
bool is_history_unsaved(int p_idx);
|
||||
bool has_undo();
|
||||
bool has_redo();
|
||||
bool has_history(int p_idx) const;
|
||||
|
||||
String get_current_action_name();
|
||||
int get_current_action_history_id();
|
||||
|
|
Loading…
Reference in New Issue