remove Assert preventing registration of multiple nested paths

This commit is contained in:
GHXX 2025-04-14 12:09:55 +02:00
parent d152b8f3ae
commit 6ad805841d

View File

@ -84,17 +84,14 @@ internal class PathTree<T> where T : class {
catchAllNext.AddSuccessor(segments[1..], newLeafData); catchAllNext.AddSuccessor(segments[1..], newLeafData);
return; return;
} else { // must be single wildcard otherwise } else { // must be single wildcard otherwise
Assert(pathWildcardNext == null); pathWildcardNext ??= new();
pathWildcardNext = new();
pathWildcardNext.AddSuccessor(segments[1..], newLeafData); pathWildcardNext.AddSuccessor(segments[1..], newLeafData);
return; return;
} }
} }
// otherwise we want to add a new constant path successor // otherwise we want to add a new constant path successor
if (next == null) { next ??= new();
next = new();
}
if (next.TryGetValue(seg, out var existingNode)) { if (next.TryGetValue(seg, out var existingNode)) {
existingNode.AddSuccessor(segments[1..], newLeafData); existingNode.AddSuccessor(segments[1..], newLeafData);