diff --git a/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs b/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs index d92681b8..5309b2a6 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs @@ -897,6 +897,16 @@ Parameter name: value"); } } + [Test] + public void WriteTokenNullCheck() + { + using (JsonWriter jsonWriter = new JsonTextWriter(new StringWriter())) + { + ExceptionAssert.Throws(() => { jsonWriter.WriteToken(null); }); + ExceptionAssert.Throws(() => { jsonWriter.WriteToken(null, true); }); + } + } + [Test] public void BadWriteEndArray() { diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs index a6bc5342..942569bb 100644 --- a/Src/Newtonsoft.Json/JsonWriter.cs +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -483,7 +483,7 @@ namespace Newtonsoft.Json /// The to read the token from. public void WriteToken(JsonReader reader) { - WriteToken(reader, true, true, true); + WriteToken(reader, true); } ///