diff --git a/CDP4Common/Poco/Iteration.cs b/CDP4Common/Poco/Iteration.cs index 45b68605..5f5e90bc 100644 --- a/CDP4Common/Poco/Iteration.cs +++ b/CDP4Common/Poco/Iteration.cs @@ -138,7 +138,7 @@ public IEnumerable QueryUnreferencedElements() var unreferencedElementDefinitions = this.Element.ToList(); unreferencedElementDefinitions.RemoveAll(x => associatedElementDefinitions.Any(e => e.Iid == x.Iid)); - unreferencedElementDefinitions.RemoveAll(x => x.Iid == this.TopElement.Iid); + unreferencedElementDefinitions.RemoveAll(x => x.Iid == this.TopElement?.Iid); return unreferencedElementDefinitions; }