From 9695af51624a99a9ee125b5ad3794a19cfdaa13e Mon Sep 17 00:00:00 2001 From: thedmd Date: Thu, 30 Jul 2026 21:25:37 +0200 Subject: [PATCH] DrawList: fixed passing large thickness value (e.g. 1e20f) to thickness crashing the code. --- imgui_draw.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index d3d62bf6e..849fa2aee 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -921,8 +921,10 @@ void ImDrawList::_SelectFringeTexture(float screen_thickness, ImVec4* out_tex_uv int texture_idx; if (screen_thickness <= IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH) IM_LIKELY texture_idx = (int)((screen_thickness - 1.0f) * IM_DRAWLIST_TEX_LINES_SAMPLE_COUNT + 0.5f) + (IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1); + else if (screen_thickness < (float)IM_DRAWLIST_TEX_LINES_WIDTH_MAX - 1.5f) IM_LIKELY + texture_idx = (int)(screen_thickness + 0.5f); else - texture_idx = ImMin((int)(screen_thickness + 0.5f), IM_DRAWLIST_TEX_LINES_WIDTH_MAX - 1); + texture_idx = IM_DRAWLIST_TEX_LINES_WIDTH_MAX - 1; // Catches large values of screen_thickness (and +inf/NaN) that a ImMin() wouldn't. // Scale the fringe so that the texture matches the line thickness. ImVec4 tex_uvs = _Data->TexUvLines[texture_idx];