Fixed a crash, when press "Esc" key in TextEdit control

Fix for #13458 - Crash using cut tool. (SPE-2545)
This commit is contained in:
YuSanka 2024-11-01 15:43:55 +01:00 committed by Lukas Matena
parent 7ca4faf009
commit da79ad4937
2 changed files with 4 additions and 1 deletions

View File

@ -3293,7 +3293,7 @@ const ImFontGlyph* ImFont::FindGlyph(ImWchar c) const
}
const ImWchar i = IndexLookup.Data[c];
if (i == (ImWchar)-1) {
imgui_rendered_fallback_glyph(c);
imgui_rendered_fallback_glyph(c);
return FallbackGlyph;
}
return &Glyphs.Data[i];

View File

@ -57,6 +57,9 @@ bool s_font_cjk;
// a fallback glyph for c.
void imgui_rendered_fallback_glyph(ImWchar c)
{
if (c == 0)
return;
if (ImGui::GetIO().Fonts->Fonts[0] == ImGui::GetFont()) {
// Only do this when we are using the default ImGui font. Otherwise this would conflict with
// EmbossStyleManager's font handling and we would load glyphs needlessly.