-Fix ReadAsBytes for empty strings
-Fix (hopefully) signing merged assemblies
This commit is contained in:
@@ -337,8 +337,16 @@ namespace Newtonsoft.Json
|
||||
case '\'':
|
||||
ReadStringIntoBuffer(currentChar);
|
||||
|
||||
byte[] data = Convert.FromBase64CharArray(_buffer.GetInternalBuffer(), 0, _buffer.Position);
|
||||
_buffer.Position = 0;
|
||||
byte[] data;
|
||||
if (_buffer.Position == 0)
|
||||
{
|
||||
data = new byte[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
data = Convert.FromBase64CharArray(_buffer.GetInternalBuffer(), 0, _buffer.Position);
|
||||
_buffer.Position = 0;
|
||||
}
|
||||
|
||||
SetToken(JsonToken.Bytes, data);
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace Newtonsoft.Json.Linq
|
||||
// attempt to convert possible base 64 string to bytes
|
||||
if (TokenType == JsonToken.String)
|
||||
{
|
||||
byte[] data = Convert.FromBase64String((string)Value);
|
||||
string s = (string) Value;
|
||||
byte[] data = (s.Length == 0) ? new byte[0] : Convert.FromBase64String(s);
|
||||
SetToken(JsonToken.Bytes, data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user