From 8b451a7a8bc2a8212bb5dc805f7bc568385d4dd9 Mon Sep 17 00:00:00 2001 From: yk35 Date: Thu, 9 May 2024 12:08:25 +0900 Subject: [PATCH] Fixed a NullReferenceException that occurs when selecting the BoundingBox item of a linked element. --- .../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 }; + } } }