From e37aa3ed90f064b9095e37584fd04b9ee6555b41 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Wed, 16 Feb 2022 12:00:37 -0800 Subject: [PATCH] RenderWidget: Fix random crash due to missing ImGui context `ImGui::GetIO` performs an assertion that a context exists, and if one doesn't then things will likely crash. Unfortunately this crash is hard to consistently reproduce. --- Source/Core/DolphinQt/RenderWidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Core/DolphinQt/RenderWidget.cpp b/Source/Core/DolphinQt/RenderWidget.cpp index cb55877ace..891d3614c8 100644 --- a/Source/Core/DolphinQt/RenderWidget.cpp +++ b/Source/Core/DolphinQt/RenderWidget.cpp @@ -554,6 +554,9 @@ void RenderWidget::SetImGuiKeyMap() }}; auto lock = g_renderer->GetImGuiLock(); + if (!ImGui::GetCurrentContext()) + return; + for (auto [imgui_key, qt_key] : key_map) ImGui::GetIO().KeyMap[imgui_key] = (qt_key & 0x1FF); }