1
0
mirror of synced 2025-02-17 18:59:21 +01:00

fix: ImHex crashing when no fonts were loaded

This commit is contained in:
WerWolv 2023-12-20 16:31:31 +01:00
parent e3e117a14e
commit 6163f6c4a0

View File

@ -92,7 +92,9 @@ namespace hex {
RequestOpenPopup::unsubscribe(this);
WorkspaceManager::exportToFile();
ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.curr_workspace", WorkspaceManager::getCurrentWorkspace()->first);
if (auto workspace = WorkspaceManager::getCurrentWorkspace(); workspace != WorkspaceManager::getWorkspaces().end())
ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.curr_workspace", workspace->first);
this->exitImGui();
this->exitGLFW();
@ -1166,6 +1168,13 @@ namespace hex {
auto fonts = ImHexApi::Fonts::getFontAtlas();
if (fonts == nullptr) {
fonts = IM_NEW(ImFontAtlas)();
fonts->AddFontDefault();
fonts->Build();
}
// Initialize ImGui and all other ImGui extensions
GImGui = ImGui::CreateContext(fonts);
GImPlot = ImPlot::CreateContext();