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.
This commit is contained in:
parent
c931529e7a
commit
e37aa3ed90
|
@ -554,6 +554,9 @@ void RenderWidget::SetImGuiKeyMap()
|
||||||
}};
|
}};
|
||||||
auto lock = g_renderer->GetImGuiLock();
|
auto lock = g_renderer->GetImGuiLock();
|
||||||
|
|
||||||
|
if (!ImGui::GetCurrentContext())
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto [imgui_key, qt_key] : key_map)
|
for (auto [imgui_key, qt_key] : key_map)
|
||||||
ImGui::GetIO().KeyMap[imgui_key] = (qt_key & 0x1FF);
|
ImGui::GetIO().KeyMap[imgui_key] = (qt_key & 0x1FF);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue