[Bf-blender-cvs] [4c0fc60105d] master: UndoSystem: Early out from core undo/redo handlers when undo step is NULL.

Bastien Montagne noreply at git.blender.org
Thu Jan 7 15:58:28 CET 2021


Commit: 4c0fc60105d7b7ff3f5c926510d77bb261e71977
Author: Bastien Montagne
Date:   Thu Jan 7 12:15:22 2021 +0100
Branches: master
https://developer.blender.org/rB4c0fc60105d7b7ff3f5c926510d77bb261e71977

UndoSystem: Early out from core undo/redo handlers when undo step is NULL.

Also added `undosys_stack_validate` debug check to redo case.

===================================================================

M	source/blender/blenkernel/intern/undo_system.c

===================================================================

diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index 9c7e226007a..e5d2d4a9f0b 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -675,9 +675,11 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
                                         bool use_skip)
 {
   UNDO_NESTED_ASSERT(false);
-  if (us) {
-    undosys_stack_validate(ustack, true);
+  if (us == NULL) {
+    return false;
   }
+  undosys_stack_validate(ustack, true);
+
   UndoStep *us_prev = us ? us->prev : NULL;
   if (us) {
     /* The current state is a copy, we need to load the previous state. */
@@ -753,6 +755,11 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack,
                                         bool use_skip)
 {
   UNDO_NESTED_ASSERT(false);
+  if (us == NULL) {
+    return false;
+  }
+  undosys_stack_validate(ustack, true);
+
   UndoStep *us_next = us ? us->next : NULL;
   /* Unlike undo accumulate, we always use the next. */
   us = us_next;



More information about the Bf-blender-cvs mailing list