diff --git a/reflect/protodesc/protodesc.go b/reflect/protodesc/protodesc.go index 187eb8ba..f6609088 100644 --- a/reflect/protodesc/protodesc.go +++ b/reflect/protodesc/protodesc.go @@ -13,6 +13,7 @@ import ( "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/internal/prototype" "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/types/descriptorpb" ) @@ -53,6 +54,9 @@ type Resolver interface { // The caller must relinquish full ownership of the input fd and must not // access or mutate any fields. func NewFile(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) { + if r == nil { + r = (*protoregistry.Files)(nil) // empty resolver + } var f prototype.File switch fd.GetSyntax() { case "proto2", "":