Skip to content

Commit

Permalink
Docking: Fix a crash that could occur with a malformed ini file (Dock…
Browse files Browse the repository at this point in the history
…Node Parent value pointing to a missing node)
  • Loading branch information
ocornut committed Aug 1, 2019
1 parent 967073b commit 3aa9aae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11426,13 +11426,14 @@ static void ImGui::DockContextPruneUnusedSettingsNodes(ImGuiContext* ctx)
}

// Count reference to dock ids from window settings
// We guard against the possibility of an invalid .ini file (RootID may point to a missing node)
for (int settings_n = 0; settings_n < g.SettingsWindows.Size; settings_n++)
if (ImGuiID dock_id = g.SettingsWindows[settings_n].DockId)
if (ImGuiDockContextPruneNodeData* data = pool.GetByKey(dock_id))
{
ImGuiDockContextPruneNodeData* data_root = (data->RootID == dock_id) ? data : pool.GetByKey(data->RootID);
data->CountWindows++;
data_root->CountChildWindows++;
if (ImGuiDockContextPruneNodeData* data_root = (data->RootID == dock_id) ? data : pool.GetByKey(data->RootID))
data_root->CountChildWindows++;
}

// Prune
Expand Down

0 comments on commit 3aa9aae

Please sign in to comment.