From 1e4cf67a530d8f1b178ff45b8b92848890a93349 Mon Sep 17 00:00:00 2001 From: Thomas Ruf Date: Mon, 21 Jan 2019 16:43:07 +0100 Subject: [PATCH] avoid floating point exception when _EM_OVERFLOW is enabled (#2303) --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index d00f46dc..81cf443d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3729,7 +3729,7 @@ void ImGui::EndFrame() IM_ASSERT(g.FrameScopeActive && "Forgot to call ImGui::NewFrame()?"); // Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) - if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f) + if (g.IO.ImeSetInputScreenPosFn && (g.PlatformImeLastPos.x == FLT_MAX || ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f)) { g.IO.ImeSetInputScreenPosFn((int)g.PlatformImePos.x, (int)g.PlatformImePos.y); g.PlatformImeLastPos = g.PlatformImePos;