diff --git a/src/FakeXrmEasy.Core/Extensions/OptionSetValueCollectionExtensions.cs b/src/FakeXrmEasy.Core/Extensions/OptionSetValueCollectionExtensions.cs
index 7084a2db..1350712f 100644
--- a/src/FakeXrmEasy.Core/Extensions/OptionSetValueCollectionExtensions.cs
+++ b/src/FakeXrmEasy.Core/Extensions/OptionSetValueCollectionExtensions.cs
@@ -21,6 +21,8 @@ public static class OptionSetValueCollectionExtensions
///
public static HashSet ConvertToHashSetOfInt(this object input, bool isOptionSetValueCollectionAccepted)
{
+ if (input == null) return null;
+
var set = new HashSet();
var faultReason = $"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter" +
diff --git a/tests/FakeXrmEasy.Core.Tests/Extensions/OptionSetValueCollectionExtensionsTests.cs b/tests/FakeXrmEasy.Core.Tests/Extensions/OptionSetValueCollectionExtensionsTests.cs
index ab8078ac..2f76b1e1 100644
--- a/tests/FakeXrmEasy.Core.Tests/Extensions/OptionSetValueCollectionExtensionsTests.cs
+++ b/tests/FakeXrmEasy.Core.Tests/Extensions/OptionSetValueCollectionExtensionsTests.cs
@@ -12,6 +12,12 @@ namespace FakeXrmEasy.Core.Tests.Extensions
{
public class OptionSetValueCollectionExtensionsTests
{
+ [Fact]
+ public void Should_convert_to_null_if_null()
+ {
+ Assert.Null(OptionSetValueCollectionExtensions.ConvertToHashSetOfInt(null, true));
+ }
+
[Fact]
public void Should_convert_to_a_hash_of_int_from_an_option_set_value_collection()
{