Fix ImFont::BuildLookupTable() potential dangling pointer dereference (fix #131)

This commit is contained in:
ocornut 2015-02-13 08:56:06 +00:00
parent 941ef993d9
commit 1eef869669

View File

@ -7379,7 +7379,7 @@ void ImFont::BuildLookupTable()
{ {
Glyphs.resize(Glyphs.size() + 1); Glyphs.resize(Glyphs.size() + 1);
ImFont::Glyph& tab_glyph = Glyphs.back(); ImFont::Glyph& tab_glyph = Glyphs.back();
tab_glyph = *space_glyph; tab_glyph = *FindGlyph((unsigned short)' ');
tab_glyph.Codepoint = '\t'; tab_glyph.Codepoint = '\t';
tab_glyph.XAdvance *= 4; tab_glyph.XAdvance *= 4;
IndexXAdvance[(size_t)tab_glyph.Codepoint] = (float)tab_glyph.XAdvance; IndexXAdvance[(size_t)tab_glyph.Codepoint] = (float)tab_glyph.XAdvance;