Text3d: add assert's to check the selection and length are valid

This commit is contained in:
2013-12-29 23:16:02 +11:00
parent 873c6e5479
commit 748b800eba
2 changed files with 6 additions and 0 deletions

View File

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

View File

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