Move reflection calls until after branches that may mean they're unused
A handful of cases where reflection calls are made prior to branches that might lead to the results not being used.
This commit is contained in:
@@ -99,10 +99,6 @@ namespace Newtonsoft.Json.Converters
|
||||
/// <returns>The object value.</returns>
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
Type t = (ReflectionUtils.IsNullableType(objectType))
|
||||
? Nullable.GetUnderlyingType(objectType)
|
||||
: objectType;
|
||||
|
||||
if (reader.TokenType == JsonToken.Null)
|
||||
{
|
||||
if (!ReflectionUtils.IsNullable(objectType))
|
||||
@@ -131,6 +127,10 @@ namespace Newtonsoft.Json.Converters
|
||||
throw JsonSerializationException.Create(reader, "Unexpected token parsing binary. Expected String or StartArray, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType));
|
||||
}
|
||||
|
||||
Type t = (ReflectionUtils.IsNullableType(objectType))
|
||||
? Nullable.GetUnderlyingType(objectType)
|
||||
: objectType;
|
||||
|
||||
#if !NET20
|
||||
if (t.AssignableToTypeName(BinaryTypeName))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user