From 53856a031ed916122dabbfd4f13a3bc1b374a63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Tue, 9 Jan 2024 21:57:03 +0100 Subject: [PATCH] Fix DataCenterExtensions.SiblingsAndSelf() behavior for the root node. --- src/formats/Data/DataCenterExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/formats/Data/DataCenterExtensions.cs b/src/formats/Data/DataCenterExtensions.cs index 044c33e..544beab 100644 --- a/src/formats/Data/DataCenterExtensions.cs +++ b/src/formats/Data/DataCenterExtensions.cs @@ -91,8 +91,7 @@ public static IEnumerable SiblingsAndSelf(this DataCenterNode no { Check.Null(node); - foreach (var sibling in node.Parent?.UnsafeChildren ?? []) - yield return sibling; + return node.Parent is { } parent ? parent.Children : [node]; } public static IEnumerable SiblingsAndSelf(this DataCenterNode node, string name)