From 807fc5e85da6fe442c8037d467d9179437fbd823 Mon Sep 17 00:00:00 2001 From: snixtho Date: Sun, 29 Sep 2024 12:21:07 +0200 Subject: [PATCH] fix dependency sorting not removing the node its processing (#295) --- src/EvoSC.Modules/Util/SortedModuleCollection.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/EvoSC.Modules/Util/SortedModuleCollection.cs b/src/EvoSC.Modules/Util/SortedModuleCollection.cs index 162271455..3985da2ca 100644 --- a/src/EvoSC.Modules/Util/SortedModuleCollection.cs +++ b/src/EvoSC.Modules/Util/SortedModuleCollection.cs @@ -55,11 +55,7 @@ private List GetSortedModules() selected = dependent.Key; } - if (selected != null) - { - dependencyGraph.Remove(selected); - } - else + if (selected == null) { break; } @@ -78,6 +74,11 @@ private static void RemoveDependent(DependencyGraph dependencyGraph, KeyValuePai dependencies.Value.Remove(dependent.Key); } } + + if (dependencyGraph.ContainsKey(dependent.Key)) + { + dependencyGraph.Remove(dependent.Key); + } } private DependencyGraph MakeDependencyGraph()