Skip to content

Commit

Permalink
protobuf: Fix case where descriptor is nil
Browse files Browse the repository at this point in the history
Fixes #1410
  • Loading branch information
dirceu committed Feb 22, 2023
1 parent 05d59ed commit c09b0ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/tapioca/dsl/compilers/protobuf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def decorate
create_type_members(klass, "Key", "Value")
else
descriptor = T.unsafe(constant).descriptor
next if descriptor.nil?

case descriptor
when Google::Protobuf::EnumDescriptor
Expand Down Expand Up @@ -145,7 +146,7 @@ def decorate
klass.create_method("initialize", parameters: [kwargs_parameter], return_type: "void")
end
else
raise TypeError, "Unexpected descriptor class: #{descriptor.class.name}"
raise TypeError, "Unexpected descriptor class `#{descriptor.class.name}` for constant `#{constant}`"
end
end
end
Expand Down

0 comments on commit c09b0ea

Please sign in to comment.