Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-01-07 14:15:22 +0300
committerBastien Montagne <bastien@blender.org>2021-01-07 17:58:23 +0300
commit4c0fc60105d7b7ff3f5c926510d77bb261e71977 (patch)
tree6683ac14ad2f3222575c7a05e11c76d4f6999519 /source/blender/blenkernel/intern/undo_system.c
parent044dd42a0515e86ac768d4ad3d8aef4d7eda70f4 (diff)
UndoSystem: Early out from core undo/redo handlers when undo step is NULL.
Also added `undosys_stack_validate` debug check to redo case.
Diffstat (limited to 'source/blender/blenkernel/intern/undo_system.c')
-rw-r--r--source/blender/blenkernel/intern/undo_system.c11
1 files changed, 9 insertions, 2 deletions
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;