Merge pull request #754 from JonHanna/fix_752

Null Check on JsonWriter.WriteToken
This commit is contained in:
James Newton-King
2015-12-21 21:57:46 +13:00
2 changed files with 11 additions and 1 deletions
@@ -897,6 +897,16 @@ Parameter name: value");
} }
} }
[Test]
public void WriteTokenNullCheck()
{
using (JsonWriter jsonWriter = new JsonTextWriter(new StringWriter()))
{
ExceptionAssert.Throws<ArgumentNullException>(() => { jsonWriter.WriteToken(null); });
ExceptionAssert.Throws<ArgumentNullException>(() => { jsonWriter.WriteToken(null, true); });
}
}
[Test] [Test]
public void BadWriteEndArray() public void BadWriteEndArray()
{ {
+1 -1
View File
@@ -483,7 +483,7 @@ namespace Newtonsoft.Json
/// <param name="reader">The <see cref="JsonReader"/> to read the token from.</param> /// <param name="reader">The <see cref="JsonReader"/> to read the token from.</param>
public void WriteToken(JsonReader reader) public void WriteToken(JsonReader reader)
{ {
WriteToken(reader, true, true, true); WriteToken(reader, true);
} }
/// <summary> /// <summary>