From ec424ac16e6ecb25f820997ec0f06f9f2d1e1a6f Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 27 Jul 2025 15:11:01 +0200 Subject: [PATCH] fix: Assert when plugins failed to load --- lib/libimhex/source/api/imhex_api.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index 38e2c7d5c..7ebaf239d 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -1051,6 +1051,13 @@ namespace hex { size *= std::floor(System::getGlobalScale()); } + // If no font has been loaded, revert back to the default font to + // prevent an assertion failure in ImGui + const auto *ctx = ImGui::GetCurrentContext(); + if (font == nullptr && ctx->Font == nullptr) [[unlikely]] { + font = ImGui::GetDefaultFont(); + } + ImGui::PushFont(font, size); }