diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs index ef9059ef9..c8238e7e6 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs @@ -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); } } } diff --git a/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/Parameters/ParameterExtractor.cs b/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/Parameters/ParameterExtractor.cs index aff5b88bc..bc913be68 100644 --- a/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/Parameters/ParameterExtractor.cs +++ b/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/Parameters/ParameterExtractor.cs @@ -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; @@ -72,8 +73,8 @@ ILogger logger var factor = _scalingServiceToSpeckle.ScaleLength(1); var structureDictionary = new Dictionary(); 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) {