Skip to content

Commit 1206619

Browse files
committed
EditorContext::Begin: handle ImGuiEx::Canvas::Begin return at initial 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
1 parent 2f99b2d commit 1206619

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

imgui_node_editor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,9 +1123,10 @@ void ed::EditorContext::Begin(const char* id, const ImVec2& size)
11231123

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

11301131
LoadSettings();
11311132
m_IsInitialized = true;

0 commit comments

Comments
 (0)