Fonts: fixed NewFrame() when atlas builder has been created but fonts not added. Fixed GetCustomRect() after atlas clear.

This commit is contained in:
ocornut
2025-06-11 13:20:17 +02:00
parent 29fbf3c1ec
commit e1481a731d
2 changed files with 3 additions and 1 deletions

View File

@@ -8668,7 +8668,7 @@ ImFont* ImGui::GetDefaultFont()
{
ImGuiContext& g = *GImGui;
ImFontAtlas* atlas = g.IO.Fonts;
if (atlas->Builder == NULL)
if (atlas->Builder == NULL || atlas->Fonts.Size == 0)
ImFontAtlasBuildMain(atlas);
return g.IO.FontDefault ? g.IO.FontDefault : atlas->Fonts[0];
}