From 9f6aae3bf267c4fb7ac2941f000393dc8341eaa8 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Sep 2022 19:48:27 +0200 Subject: [PATCH] Nav: Fixed race condition pressing Esc during popup opening frame causing crash. --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 5af4b2d9..69efe64b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -10859,7 +10859,7 @@ static void ImGui::NavUpdateCancelRequest() SetNavID(child_window->ChildId, ImGuiNavLayer_Main, 0, WindowRectAbsToRel(parent_window, child_rect)); NavRestoreHighlightAfterMove(); } - else if (g.OpenPopupStack.Size > 0 && !(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal)) + else if (g.OpenPopupStack.Size > 0 && g.OpenPopupStack.back().Window != NULL && !(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal)) { // Close open popup/menu ClosePopupToLevel(g.OpenPopupStack.Size - 1, true);