[Bf-blender-cvs] [9686554] master: Text3d: avoid assert, clamp position before getting the selection

Campbell Barton noreply at git.blender.org
Sun Jan 5 17:28:02 CET 2014


Commit: 96865546333d5805a019729392f599c8dd66fc7a
Author: Campbell Barton
Date:   Mon Jan 6 03:27:34 2014 +1100
https://developer.blender.org/rB96865546333d5805a019729392f599c8dd66fc7a

Text3d: avoid assert, clamp position before getting the selection

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

M	source/blender/editors/curve/editfont.c

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

diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 1fbd3a0..ef3d7da 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1033,6 +1033,10 @@ static int move_cursor(bContext *C, int type, int select)
 	if (cursmove == -1)
 		return OPERATOR_CANCELLED;
 
+	if      (ef->pos > ef->len)  ef->pos = ef->len;
+	else if (ef->pos >= MAXTEXT) ef->pos = MAXTEXT;
+	else if (ef->pos < 0)        ef->pos = 0;
+
 	if (select == 0) {
 		if (ef->selstart) {
 			struct Main *bmain = CTX_data_main(C);
@@ -1041,10 +1045,6 @@ static int move_cursor(bContext *C, int type, int select)
 		}
 	}
 
-	if (ef->pos > ef->len) ef->pos = ef->len;
-	else if (ef->pos >= MAXTEXT) ef->pos = MAXTEXT;
-	else if (ef->pos < 0) ef->pos = 0;
-
 	text_update_edited(C, scene, obedit, select, cursmove);
 
 	if (select)




More information about the Bf-blender-cvs mailing list