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); }