-Fixed error handling serializing invalid JSON in certain cases

This commit is contained in:
James Newton-King
2012-08-05 14:20:17 +12:00
parent 689f1a763b
commit 64414169eb
6 changed files with 82 additions and 3 deletions
+3 -1
View File
@@ -582,7 +582,6 @@ namespace Newtonsoft.Json
private void AutoCompleteClose(JsonToken tokenBeingClosed)
{
// write closing symbol and calculate new state
int levelsToComplete = 0;
JsonContainerType type = GetTypeForCloseToken(tokenBeingClosed);
@@ -612,6 +611,9 @@ namespace Newtonsoft.Json
{
JsonToken token = GetCloseTokenForType(Pop());
if (_currentState == State.Property)
WriteNull();
if (_formatting == Formatting.Indented)
{
if (_currentState != State.ObjectStart && _currentState != State.ArrayStart)