mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Internals: Routing recoverable user errors via IMGUI_USER_ERROR() macro. (#1651)
This commit is contained in:
11
imgui.cpp
11
imgui.cpp
@ -5820,17 +5820,16 @@ void ImGui::End()
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
// Error checking: verify that user hasn't called End() too many times!
|
||||
// FIXME-ERRORHANDLING
|
||||
if (g.CurrentWindowStack.Size <= 1 && g.WithinFrameScopeWithImplicitWindow)
|
||||
{
|
||||
IM_ASSERT(g.CurrentWindowStack.Size > 1 && "Calling End() too many times!");
|
||||
IMGUI_USER_ERROR(g.CurrentWindowStack.Size > 1, "Calling End() too many times!");
|
||||
return;
|
||||
}
|
||||
IM_ASSERT(g.CurrentWindowStack.Size > 0);
|
||||
|
||||
// Error checking: verify that user doesn't directly call End() on a child window.
|
||||
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||
IM_ASSERT(g.WithinEndChild && "Must call EndChild() and not End()!");
|
||||
IMGUI_USER_ERROR(g.WithinEndChild, "Must call EndChild() and not End()!");
|
||||
|
||||
// Close anything that is open
|
||||
if (window->DC.CurrentColumns)
|
||||
@ -7004,13 +7003,13 @@ static void ImGui::ErrorCheckEndFrame()
|
||||
{
|
||||
if (g.CurrentWindowStack.Size > 1)
|
||||
{
|
||||
IM_ASSERT(g.CurrentWindowStack.Size == 1 && "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
|
||||
while (g.CurrentWindowStack.Size > 1) // FIXME-ERRORHANDLING
|
||||
IMGUI_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
|
||||
while (g.CurrentWindowStack.Size > 1)
|
||||
End();
|
||||
}
|
||||
else
|
||||
{
|
||||
IM_ASSERT(g.CurrentWindowStack.Size == 1 && "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
|
||||
IMGUI_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user