mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-18 04:45:39 +00:00
Added a precaution to prevent crashes in case of broken fonts being used
This commit is contained in:
parent
75b93794b0
commit
7a8bd97226
|
@ -760,6 +760,9 @@ std::vector<Font::ShapeSegment> Font::shapeText(const std::string& text)
|
||||||
lastCursor = textCursor;
|
lastCursor = textCursor;
|
||||||
const unsigned int unicode {Utils::String::chars2Unicode(text, textCursor)};
|
const unsigned int unicode {Utils::String::chars2Unicode(text, textCursor)};
|
||||||
Glyph* currGlyph {getGlyph(unicode)};
|
Glyph* currGlyph {getGlyph(unicode)};
|
||||||
|
// Extra precaution in case the font is really broken.
|
||||||
|
if (currGlyph == nullptr)
|
||||||
|
continue;
|
||||||
byteLength = textCursor - lastCursor;
|
byteLength = textCursor - lastCursor;
|
||||||
|
|
||||||
if (unicode == '\'' || unicode == '\n' || currGlyph->fontHB == nullptr) {
|
if (unicode == '\'' || unicode == '\n' || currGlyph->fontHB == nullptr) {
|
||||||
|
|
Loading…
Reference in a new issue