diff options
author | Jon Skeet <jonskeet@google.com> | 2018-03-01 13:20:40 +0000 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2018-03-01 13:20:40 +0000 |
commit | 822b924d593f67d2536c7bdeaf55cedf614da244 (patch) | |
tree | 507654051869fb7eabd94378a33c15b88b642aa5 /csharp/src/Google.Protobuf/JsonParser.cs | |
parent | 9dc0a4d5cf181845c4c8ca6c482ec38cc1835bbc (diff) | |
download | protobuf-822b924d593f67d2536c7bdeaf55cedf614da244.tar.gz protobuf-822b924d593f67d2536c7bdeaf55cedf614da244.tar.bz2 protobuf-822b924d593f67d2536c7bdeaf55cedf614da244.zip |
Allow list values to be null when parsing
Diffstat (limited to 'csharp/src/Google.Protobuf/JsonParser.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/JsonParser.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs index 3621b0c0..284bce93 100644 --- a/csharp/src/Google.Protobuf/JsonParser.cs +++ b/csharp/src/Google.Protobuf/JsonParser.cs @@ -264,11 +264,12 @@ namespace Google.Protobuf return; } tokenizer.PushBack(token); - if (token.Type == JsonToken.TokenType.Null) + object value = ParseSingleValue(field, tokenizer); + if (value == null) { throw new InvalidProtocolBufferException("Repeated field elements cannot be null"); } - list.Add(ParseSingleValue(field, tokenizer)); + list.Add(value); } } |