Skip to content

Commit

Permalink
EditorContext::Begin: handle ImGuiEx::Canvas::Begin return at initial…
Browse files Browse the repository at this point in the history
… setup

if ImGuiEx::Canvas::Begin returns false (which can happen if the window is too small
and the canvas is Clipped), then the subsequent call to ImGuiEx::Canvas::End()
will trigger an IM_ASSERT
  • Loading branch information
pthom committed Nov 21, 2022
1 parent 2f99b2d commit 1206619
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions imgui_node_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,9 +1123,10 @@ void ed::EditorContext::Begin(const char* id, const ImVec2& size)

if (!m_IsInitialized)
{
// Cycle canvas so it has a change to setup its size before settings are loaded
m_Canvas.Begin(id, canvasSize);
m_Canvas.End();
// Cycle canvas, so it has a chance to set up its size before settings are loaded
bool success = m_Canvas.Begin(id, canvasSize);
if (success)
m_Canvas.End();

LoadSettings();
m_IsInitialized = true;
Expand Down

0 comments on commit 1206619

Please sign in to comment.