diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-05 10:59:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-05 11:01:12 +0300 |
commit | 47b6e23271b51429d45434e02ba137b8fdac3b45 (patch) | |
tree | 64b178a21cd7a37e6e0bbb28f7659279f623572f /source/blender | |
parent | d59c2d12b1226afa3789b0ef142f8f6cc9356ead (diff) |
Fix crash w/ empty text undo operations
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_text/text_undo.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c index ef9cfccdc1c..f977e2c0d4f 100644 --- a/source/blender/editors/space_text/text_undo.c +++ b/source/blender/editors/space_text/text_undo.c @@ -90,10 +90,16 @@ static bool text_undosys_poll(bContext *C) static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p) { TextUndoStep *us = (TextUndoStep *)us_p; + BLI_assert(BLI_array_is_zeroed(&us->data, 1)); + Text *text = CTX_data_edit_text(C); - us->text_ref.ptr = text; - BLI_assert(BLI_array_is_zeroed(&us->data, 1)); + /* No undo data was generated. Hint, use global undo here. */ + if (text->undo_pos == -1) { + return false; + } + + us->text_ref.ptr = text; us->data.buf = text->undo_buf; us->data.pos = text->undo_pos; |