From a5203ea0ea36a0fe059818044f8daa730b119c4d Mon Sep 17 00:00:00 2001 From: Malkierian Date: Mon, 8 Jul 2024 16:05:22 -0700 Subject: [PATCH] Move DrawContents and closing ImGui::End inside else tied to ImGui::Begin to prevent crash. (#643) --- src/window/gui/GuiWindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/window/gui/GuiWindow.cpp b/src/window/gui/GuiWindow.cpp index 71761be..4c9f86b 100644 --- a/src/window/gui/GuiWindow.cpp +++ b/src/window/gui/GuiWindow.cpp @@ -66,9 +66,10 @@ void GuiWindow::Draw() { } if (!ImGui::Begin(mName.c_str(), &mIsVisible, mWindowFlags)) { ImGui::End(); + } else { + DrawElement(); + ImGui::End(); } - DrawElement(); - ImGui::End(); // Sync up the IsVisible flag if it was changed by ImGui SyncVisibilityConsoleVariable(); }