File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -377,16 +377,20 @@ void EditorUndoRedoManager::set_history_as_saved(int p_id) {
377377
378378void EditorUndoRedoManager::set_history_as_unsaved (int p_id) {
379379 History &history = get_or_create_history (p_id);
380- history.saved_version = - 1 ;
380+ history.saved_version = 0 ;
381381}
382382
383383bool EditorUndoRedoManager::is_history_unsaved (int p_id) {
384384 History &history = get_or_create_history (p_id);
385+ if (history.saved_version == 0 ) {
386+ return true ;
387+ }
385388
386389 int version_difference = history.undo_redo ->get_version () - history.saved_version ;
387390 if (version_difference > 0 ) {
388391 List<Action>::Element *E = history.undo_stack .back ();
389392 for (int i = 0 ; i < version_difference; i++) {
393+ ERR_FAIL_NULL_V_MSG (E, false , " Inconsistent undo history." );
390394 if (E->get ().mark_unsaved ) {
391395 return true ;
392396 }
@@ -395,6 +399,7 @@ bool EditorUndoRedoManager::is_history_unsaved(int p_id) {
395399 } else if (version_difference < 0 ) {
396400 List<Action>::Element *E = history.redo_stack .back ();
397401 for (int i = 0 ; i > version_difference; i--) {
402+ ERR_FAIL_NULL_V_MSG (E, false , " Inconsistent redo history." );
398403 if (E->get ().mark_unsaved ) {
399404 return true ;
400405 }
You can’t perform that action at this time.
0 commit comments