Don't crash when trying to load a non-existent vector/bitmap character.

pull/106/head
whitequark 2017-01-02 23:48:13 +00:00
parent 02ab358bd9
commit d8932772ef
1 changed files with 6 additions and 2 deletions

View File

@ -497,8 +497,10 @@ const BitmapFont::Glyph &BitmapFont::GetGlyph(char32_t codepoint) {
mid--; mid--;
} }
// Read the codepoint.
ASCIIReader reader = { mid, unifontData.cend() }; ASCIIReader reader = { mid, unifontData.cend() };
if(reader.AtEnd()) break;
// Read the codepoint.
char32_t foundCodepoint = reader.Read16HexBits(); char32_t foundCodepoint = reader.Read16HexBits();
reader.ExpectChar(':'); reader.ExpectChar(':');
@ -724,8 +726,10 @@ const VectorFont::Glyph &VectorFont::GetGlyph(char32_t codepoint) {
mid--; mid--;
} }
// Read the codepoint.
ASCIIReader reader = { mid, lffData.cend() }; ASCIIReader reader = { mid, lffData.cend() };
if(reader.AtEnd()) break;
// Read the codepoint.
reader.ExpectChar('['); reader.ExpectChar('[');
char32_t foundCodepoint = reader.Read16HexBits(); char32_t foundCodepoint = reader.Read16HexBits();
reader.ExpectChar(']'); reader.ExpectChar(']');