diff --git a/RvtVa3c/Command.cs b/RvtVa3c/Command.cs index 8948830..4499f82 100644 --- a/RvtVa3c/Command.cs +++ b/RvtVa3c/Command.cs @@ -92,21 +92,31 @@ Va3cExportContext context /// /// Revit Document /// Include Type Parameters in the filter dialog - public void filterElementParameters( Document doc, bool includeType ) + public void filterElementParameters( + Document doc, + bool includeType ) { _parameterDictionary = new Dictionary>(); _toExportDictionary = new Dictionary>(); - FilteredElementCollector collector = new FilteredElementCollector( doc, doc.ActiveView.Id ); + FilteredElementCollector collector + = new FilteredElementCollector( doc, + doc.ActiveView.Id ); // Create a dictionary with all the properties for each category. foreach( var fi in collector ) { - + if( null == fi.Category ) + { + continue; + } string category = fi.Category.Name; - if( category != "Title Blocks" && category != "Generic Annotations" && category != "Detail Items" && category != "Cameras" ) + if( category != "Title Blocks" + && category != "Generic Annotations" + && category != "Detail Items" + && category != "Cameras" ) { IList parameters = fi.GetOrderedParameters(); List parameterNames = new List(); diff --git a/RvtVa3c/Properties/AssemblyInfo.cs b/RvtVa3c/Properties/AssemblyInfo.cs index e6712d3..98217a4 100644 --- a/RvtVa3c/Properties/AssemblyInfo.cs +++ b/RvtVa3c/Properties/AssemblyInfo.cs @@ -53,6 +53,7 @@ // 2019-10-02 2020.0.0.0 flat migration to Revit 2020 // 2020-07-10 2020.0.0.1 integrated updated build events and debug settings for Revit 2020 from pull request #16 by @pabloderen // 2020-07-10 2021.0.0.0 flat migration to Revit 2021 +// 2020-12-14 2021.0.0.1 check for null category to avoid null reference exception in issue #18 (and #17?) // -[assembly: AssemblyVersion( "2021.0.0.0" )] -[assembly: AssemblyFileVersion( "2021.0.0.0" )] +[assembly: AssemblyVersion( "2021.0.0.1" )] +[assembly: AssemblyFileVersion( "2021.0.0.1" )]