From d3c03f787d787cc0612c08e2ef6a37e76f4386f5 Mon Sep 17 00:00:00 2001 From: yk35 Date: Thu, 9 May 2024 14:04:51 +0900 Subject: [PATCH] Fixed a NullReferenceException that occurs when selecting the BoundingBox item of a linked element. (#28) --- .../DataModel/MemberAccessors/Element/Element_BoundingBox.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sources/RevitDBExplorer/Domain/DataModel/MemberAccessors/Element/Element_BoundingBox.cs b/sources/RevitDBExplorer/Domain/DataModel/MemberAccessors/Element/Element_BoundingBox.cs index 96ebfef..2ed951c 100644 --- a/sources/RevitDBExplorer/Domain/DataModel/MemberAccessors/Element/Element_BoundingBox.cs +++ b/sources/RevitDBExplorer/Domain/DataModel/MemberAccessors/Element/Element_BoundingBox.cs @@ -20,7 +20,10 @@ public Element_BoundingBox() : base((document, element) => element.get_BoundingB private static IEnumerable Snoop(Document document, Element element) { yield return new SnoopableObject(document, null, new[] { new SnoopableObject(document, element.get_BoundingBox(null)) }) { NamePrefix = "view:" }; - yield return new SnoopableObject(document, null, new[] { new SnoopableObject(document, element.get_BoundingBox(document.ActiveView)) }) { NamePrefix = "view:", Name = "Active view: " + document.ActiveView.Name }; + if (document.ActiveView != null) + { + yield return new SnoopableObject(document, null, new[] { new SnoopableObject(document, element.get_BoundingBox(document.ActiveView)) }) { NamePrefix = "view:", Name = "Active view: " + document.ActiveView.Name }; + } } }