Skip to content

Commit

Permalink
Avoiding some reference null exceptions (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock authored Nov 20, 2024
1 parent 885bb41 commit 4748080
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ private async Task RunExpirationChecks()
// continue;
// }

foreach (var changedElementId in ChangedObjectIds.Keys.ToArray())
foreach (var changedElementId in ChangedObjectIds.Keys)
{
if (sender.SendFilter.NotNull().IdMap.NotNull().ContainsKey(changedElementId.ToString()))
if (sender.SendFilter?.IdMap?.TryGetValue(changedElementId.ToString(), out var id) ?? false)
{
objUniqueIds.Add(sender.SendFilter.NotNull().IdMap.NotNull()[changedElementId.ToString()]);
objUniqueIds.Add(id);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Speckle.Converters.RevitShared.Services;
using Speckle.Converters.RevitShared.Settings;
using Speckle.Sdk;
using Speckle.Sdk.Common;

namespace Speckle.Converters.RevitShared.ToSpeckle;

Expand Down Expand Up @@ -72,8 +73,8 @@ ILogger<ParameterExtractor> logger
var factor = _scalingServiceToSpeckle.ScaleLength(1);
var structureDictionary = new Dictionary<string, object?>();
var structure = hostObjectAttr.GetCompoundStructure();
var layers = structure.GetLayers();
foreach (var layer in layers)
var layers = structure?.GetLayers();
foreach (var layer in layers.Empty())
{
if (_settingsStore.Current.Document.GetElement(layer.MaterialId) is DB.Material material)
{
Expand Down

0 comments on commit 4748080

Please sign in to comment.