1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-16 12:03:27 +01:00

Docking: Fix a crash that could occur with a malformed ini file (DockNode Parent value pointing to a missing node)

This commit is contained in:
omar 2019-08-01 15:50:05 -07:00
parent 967073ba3d
commit 3aa9aae0be

View File

@ -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