From f6fc166584783b8a886f102ea8623a24115ca5c4 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 12 Jun 2025 11:07:08 +0200 Subject: [PATCH] TreeNode: fixed runtime asan warning (#2920) imgui_widgets.cpp:6923:52: runtime error: shift exponent -1 is negative --- imgui_widgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index cdca228c4..ba35e531b 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -6914,7 +6914,7 @@ void ImGui::TreeNodeDrawLineToChildNode(const ImVec2& target_pos) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - if ((window->DC.TreeHasStackDataDepthMask & (1 << (window->DC.TreeDepth - 1))) == 0) + if (window->DC.TreeDepth == 0 || (window->DC.TreeHasStackDataDepthMask & (1 << (window->DC.TreeDepth - 1))) == 0) return; ImGuiTreeNodeStackData* parent_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];