remove redundant check for IsNullableType (#1450)
This commit is contained in:
committed by
James Newton-King
parent
ab3315f1d5
commit
8f65999684
@@ -126,7 +126,7 @@ namespace Newtonsoft.Json.Converters
|
|||||||
bool nullable = ReflectionUtils.IsNullableType(objectType);
|
bool nullable = ReflectionUtils.IsNullableType(objectType);
|
||||||
if (reader.TokenType == JsonToken.Null)
|
if (reader.TokenType == JsonToken.Null)
|
||||||
{
|
{
|
||||||
if (!ReflectionUtils.IsNullableType(objectType))
|
if (!nullable)
|
||||||
{
|
{
|
||||||
throw JsonSerializationException.Create(reader, "Cannot convert null value to {0}.".FormatWith(CultureInfo.InvariantCulture, objectType));
|
throw JsonSerializationException.Create(reader, "Cannot convert null value to {0}.".FormatWith(CultureInfo.InvariantCulture, objectType));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user