Skip to content

Commit a82e734

Browse files
authored
Merge pull request #108 from marsqing/master
[ProtoBuf]fix NPE in skip unknown nested key
2 parents 607b058 + b2a6ca6 commit a82e734

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

protobuf/src/main/java/com/fasterxml/jackson/dataformat/protobuf/ProtobufParser.java

+4
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ private JsonToken _handleNestedKey(int tag) throws IOException
736736
if ((_currentField == null) || (f = _currentField.nextOrThisIf(id)) == null) {
737737
f = _currentMessage.field(id);
738738
}
739+
// Note: may be null; if so, value needs to be skipped
740+
if (f == null) {
741+
return _skipUnknownField(id, wireType);
742+
}
739743
_parsingContext.setCurrentName(f.name);
740744
if (!f.isValidFor(wireType)) {
741745
_reportIncompatibleType(f, wireType);

0 commit comments

Comments
 (0)