[draw] Check len while checking for UTF-8 chars
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
afdc57bc97
commit
84df60e11b
|
@ -228,7 +228,7 @@ draw_text(DrawCtx *ctx,
|
||||||
/* we can't blindly null the char, we need to check if it's not part of
|
/* we can't blindly null the char, we need to check if it's not part of
|
||||||
* a multi byte char: if mbtowc return -1, we know that we must go back
|
* a multi byte char: if mbtowc return -1, we know that we must go back
|
||||||
* in the string to find the beginning of the multi byte char */
|
* in the string to find the beginning of the multi byte char */
|
||||||
while(mbtowc(NULL, buf + len, a_strlen(buf + len)) < 0)
|
while(len && mbtowc(NULL, buf + len, a_strlen(buf + len)) < 0)
|
||||||
len--;
|
len--;
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue