Commit: 47b6e23271b51429d45434e02ba137b8fdac3b45
Author: Campbell Barton
Date:   Thu Apr 5 09:59:21 2018 +0200
Branches: master
https://developer.blender.org/rB47b6e23271b51429d45434e02ba137b8fdac3b45

Fix crash w/ empty text undo operations

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

M       source/blender/editors/space_text/text_undo.c

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

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;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to