[Bf-blender-cvs] [47b6e23271b] master: Fix crash w/ empty text undo operations

Campbell Barton noreply at git.blender.org
Thu Apr 5 10:03:35 CEST 2018


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;



More information about the Bf-blender-cvs mailing list