Skip to content

Commit

Permalink
Fix support for protobuf 3.5+, ExtensionRegistry cannot be null
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscizek committed Mar 18, 2019
1 parent 911a5d4 commit 083bf24
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ final class ProtoResponseBodyConverter<T extends MessageLite>

@Override public T convert(ResponseBody value) throws IOException {
try {
return parser.parseFrom(value.byteStream(), registry);
return registry == null ? parser.parseFrom(value.byteStream())
: parser.parseFrom(value.byteStream(), registry);
} catch (InvalidProtocolBufferException e) {
throw new RuntimeException(e); // Despite extending IOException, this is data mismatch.
} finally {
Expand Down

0 comments on commit 083bf24

Please sign in to comment.