From b0438d27a40789e9806bba00e6ab6214e5b9485d Mon Sep 17 00:00:00 2001 From: brentfpage Date: Sun, 11 Oct 2026 10:33:14 -0700 Subject: [PATCH] add guard against div-by-0 when processing SDL pinch events --- imgui.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index c152e821d..2e6a12b19 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2086,6 +2086,8 @@ void ImGuiIO::AddPinchUpdateEvent(float scale, float span_x, float span_y, float e.Source = ImGuiInputSource_Mouse; e.EventId = g.InputEventsNextEventId++; float norm = ImSqrt(ImPow(span_x,2) + ImPow(span_y,2)); + if(norm == 0) + return; e.MouseWheel.WheelX = (1-scale)*100*span_x/norm; e.MouseWheel.WheelY = (1-scale)*100*span_y/norm; e.MouseWheel.MouseSource = g.InputEventsNextMouseSource;