Browse Source

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

ocornut 10 năm trước cách đây
mục cha
commit
1eef869669
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      imgui.cpp

+ 1 - 1
imgui.cpp

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