From 6fce640e5c281c11a28bb3c7ecc7eaf21924907b Mon Sep 17 00:00:00 2001 From: Philip Dimitratos Date: Tue, 31 Oct 2017 15:20:20 -0700 Subject: [PATCH] Fixed issue where PartialSerializedJsonOutputFormatter would throw exception when first instance of a type to be returned is null --- .../Protocol/PartialSerializedJsonOutputFormatter.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Domain/Sia.Shared/Protocol/PartialSerializedJsonOutputFormatter.cs b/Domain/Sia.Shared/Protocol/PartialSerializedJsonOutputFormatter.cs index 23d1d26..3b15f44 100644 --- a/Domain/Sia.Shared/Protocol/PartialSerializedJsonOutputFormatter.cs +++ b/Domain/Sia.Shared/Protocol/PartialSerializedJsonOutputFormatter.cs @@ -35,8 +35,9 @@ namespace Sia.Shared.Protocol protected override bool CanWriteType(Type type) { - if (!type.IsGenericType) return false; - if (type.GetGenericArguments().Count() != 1) return false; + if (type is null + || !type.IsGenericType + || type.GetGenericArguments().Count() != 1) return false; var enumIntName = typeof(IEnumerable<>).ToString(); var enumerableInterface = type.GetInterface(enumIntName