From da79ad4937c36196e56cf09a6ee393304d68cb6d Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 1 Nov 2024 15:43:55 +0100 Subject: [PATCH] Fixed a crash, when press "Esc" key in TextEdit control Fix for #13458 - Crash using cut tool. (SPE-2545) --- bundled_deps/imgui/imgui/imgui_draw.cpp | 2 +- src/slic3r/GUI/ImGuiWrapper.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bundled_deps/imgui/imgui/imgui_draw.cpp b/bundled_deps/imgui/imgui/imgui_draw.cpp index 62a470233b..b28e1d39ff 100644 --- a/bundled_deps/imgui/imgui/imgui_draw.cpp +++ b/bundled_deps/imgui/imgui/imgui_draw.cpp @@ -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]; diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index b82c396629..da5b778ed0 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -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.