Merge ifs into following switch on same expression in ReadAsBytes (#1147)
This commit is contained in:
committed by
James Newton-King
parent
859d12e338
commit
ec2659e3ad
@@ -510,12 +510,9 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
JsonToken t = GetContentToken();
|
||||
|
||||
if (t == JsonToken.None)
|
||||
switch (t)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (TokenType == JsonToken.StartObject)
|
||||
case JsonToken.StartObject:
|
||||
{
|
||||
ReadIntoWrappedTypeObject();
|
||||
|
||||
@@ -530,9 +527,6 @@ namespace Newtonsoft.Json
|
||||
SetToken(JsonToken.Bytes, data, false);
|
||||
return data;
|
||||
}
|
||||
|
||||
switch (t)
|
||||
{
|
||||
case JsonToken.String:
|
||||
{
|
||||
// attempt to convert possible base 64 or GUID string to bytes
|
||||
@@ -558,6 +552,7 @@ namespace Newtonsoft.Json
|
||||
SetToken(JsonToken.Bytes, data, false);
|
||||
return data;
|
||||
}
|
||||
case JsonToken.None:
|
||||
case JsonToken.Null:
|
||||
case JsonToken.EndArray:
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user