Text3d: avoid assert, clamp position before getting the selection

This commit is contained in:
Campbell Barton 2014-01-06 03:27:34 +11:00
parent ede891808c
commit 9686554633
1 changed files with 4 additions and 4 deletions

View File

@ -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)