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:
authorCampbell Barton <ideasman42@gmail.com>2018-04-05 10:59:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-05 11:01:12 +0300
commit47b6e23271b51429d45434e02ba137b8fdac3b45 (patch)
tree64b178a21cd7a37e6e0bbb28f7659279f623572f
parentd59c2d12b1226afa3789b0ef142f8f6cc9356ead (diff)
Fix crash w/ empty text undo operations
-rw-r--r--source/blender/editors/space_text/text_undo.c10
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;