Text3d: add assert's to check the selection and length are valid
This commit is contained in:
@@ -463,6 +463,10 @@ int BKE_vfont_select_get(Object *ob, int *start, int *end)
|
||||
|
||||
if (cu->editfont == NULL || ob->type != OB_FONT) return 0;
|
||||
|
||||
BLI_assert(cu->selstart >= 0 && cu->selstart <= cu->len + 1);
|
||||
BLI_assert(cu->selend >= 0 && cu->selend <= cu->len + 1);
|
||||
BLI_assert(cu->pos >= 0 && cu->pos <= cu->len);
|
||||
|
||||
if (cu->selstart == 0) return 0;
|
||||
if (cu->selstart <= cu->selend) {
|
||||
*start = cu->selstart - 1;
|
||||
|
||||
@@ -237,6 +237,8 @@ static void update_string(Curve *cu)
|
||||
|
||||
/* Copy the wchar to UTF-8 */
|
||||
BLI_strncpy_wchar_as_utf8(cu->str, ef->textbuf, len + 1);
|
||||
|
||||
BLI_assert(len == cu->len);
|
||||
}
|
||||
|
||||
static int insert_into_textbuf(Object *obedit, uintptr_t c)
|
||||
|
||||
Reference in New Issue
Block a user