Skip to content

Commit

Permalink
check for null category to avoid null reference exception in issue #18
Browse files Browse the repository at this point in the history
…(and #17?)
  • Loading branch information
jeremytammik committed Dec 14, 2020
1 parent b52dfb0 commit c5af66c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
18 changes: 14 additions & 4 deletions RvtVa3c/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,31 @@ Va3cExportContext context
/// </summary>
/// <param name="doc">Revit Document</param>
/// <param name="includeType">Include Type Parameters in the filter dialog</param>
public void filterElementParameters( Document doc, bool includeType )
public void filterElementParameters(
Document doc,
bool includeType )
{
_parameterDictionary = new Dictionary<string, List<string>>();
_toExportDictionary = new Dictionary<string, List<string>>();

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<Parameter> parameters = fi.GetOrderedParameters();
List<string> parameterNames = new List<string>();
Expand Down
5 changes: 3 additions & 2 deletions RvtVa3c/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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" )]

0 comments on commit c5af66c

Please sign in to comment.