-Fixed casting a nullable negative SByte value

This commit is contained in:
James Newton-King
2014-11-29 00:28:33 +13:00
parent ed80d49e6e
commit 68ebba03fb
2 changed files with 3 additions and 1 deletions
@@ -290,6 +290,8 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.AreEqual(5f, (float)(new JValue(5m)));
Assert.AreEqual(5f, (float?)(new JValue(5m)));
Assert.AreEqual(5, (byte)(new JValue(5)));
Assert.AreEqual(SByte.MinValue, (sbyte?)(new JValue(SByte.MinValue)));
Assert.AreEqual(SByte.MinValue, (sbyte)(new JValue(SByte.MinValue)));
Assert.AreEqual(null, (sbyte?)JValue.CreateNull());
+1 -1
View File
@@ -868,7 +868,7 @@ namespace Newtonsoft.Json.Linq
return (sbyte?)(BigInteger)v.Value;
#endif
return (v.Value != null) ? (sbyte?)Convert.ToByte(v.Value, CultureInfo.InvariantCulture) : null;
return (v.Value != null) ? (sbyte?)Convert.ToSByte(v.Value, CultureInfo.InvariantCulture) : null;
}
/// <summary>