mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +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
ee8eebfef8
commit
852424e69d
1 changed files with 1 additions and 0 deletions
|
@ -277,6 +277,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