diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-07-19 11:59:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-07-19 11:59:14 +0300 |
commit | ccd2af43b3ab83dc873010faade1b2916553291a (patch) | |
tree | 12a6aeb29f8d3ce46da10d8fbe0814180ba16cd8 /source/blender/editors/undo | |
parent | 52a7c724b5394f7fe8a5d821cbaffa97672f615e (diff) |
Fix T78624: Crash running operators from Python in background mode
Diffstat (limited to 'source/blender/editors/undo')
-rw-r--r-- | source/blender/editors/undo/ed_undo.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 43341eadb97..50e0bb1f1c2 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -98,6 +98,14 @@ void ED_undo_push(bContext *C, const char *str) if (steps <= 0) { return; } + if (G.background) { + /* Python developers may have explicitly created the undo stack in background mode, + * otherwise allow it to be NULL, see: T60934. + * Otherwise it must never be NULL, even when undo is disabled. */ + if (wm->undo_stack == NULL) { + return; + } + } /* Only apply limit if this is the last undo step. */ if (wm->undo_stack->step_active && (wm->undo_stack->step_active->next == NULL)) { |