imgui: Fix assert caused by set_language() while new frame is open

This commit is contained in:
Vojtech Kral 2019-03-26 17:57:54 +01:00
parent b064d9662f
commit 937f6112ce

View File

@ -56,6 +56,14 @@ bool ImGuiWrapper::init()
void ImGuiWrapper::set_language(const std::string &language)
{
if (m_new_frame_open) {
// ImGUI internally locks the font between NewFrame() and EndFrame()
// NewFrame() might've been called here because of input from the 3D scene;
// call EndFrame()
ImGui::EndFrame();
m_new_frame_open = false;
}
const ImWchar *ranges = nullptr;
size_t idx = language.find('_');
std::string lang = (idx == std::string::npos) ? language : language.substr(0, idx);