mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
ttf: prevent crash while converting utf8 to unicode
If wrong utf8 sequence if given as an input, decoding return nullptr and it has to be handled correctly.
This commit is contained in:
parent
54b33fcd28
commit
934a6e5418
1 changed files with 1 additions and 0 deletions
|
@ -284,6 +284,7 @@ bool TtfLoader::read(Shape* shape, char* text, FontMetrics& out)
|
||||||
|
|
||||||
auto n = strlen(text);
|
auto n = strlen(text);
|
||||||
auto code = _codepoints(text, n);
|
auto code = _codepoints(text, n);
|
||||||
|
if (!code) return false;
|
||||||
|
|
||||||
//TODO: optimize with the texture-atlas?
|
//TODO: optimize with the texture-atlas?
|
||||||
TtfGlyphMetrics gmetrics;
|
TtfGlyphMetrics gmetrics;
|
||||||
|
|
Loading…
Add table
Reference in a new issue