From c64830bbca7ce327ad38e51ea4ddf96328804604 Mon Sep 17 00:00:00 2001 From: "@rubynerd" Date: Mon, 19 Dec 2016 23:48:48 +0000 Subject: unwrap descriptor class before comparison of RepeatedField types self->field_type_class returns the correct Ruby class, get_def_obj returns the Descriptor object used to generate the Ruby class via msgclass, so to compare the two types we get the msgclass from the descriptor. --- ruby/ext/google/protobuf_c/storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ruby') diff --git a/ruby/ext/google/protobuf_c/storage.c b/ruby/ext/google/protobuf_c/storage.c index 3ff2bda6..8e474244 100644 --- a/ruby/ext/google/protobuf_c/storage.c +++ b/ruby/ext/google/protobuf_c/storage.c @@ -598,7 +598,7 @@ static void check_repeated_field_type(VALUE val, const upb_fielddef* field) { if (self->field_type == UPB_TYPE_MESSAGE || self->field_type == UPB_TYPE_ENUM) { if (self->field_type_class != - get_def_obj(upb_fielddef_subdef(field))) { + Descriptor_msgclass(get_def_obj(upb_fielddef_subdef(field)))) { rb_raise(rb_eTypeError, "Repeated field array has wrong message/enum class"); } -- cgit v1.2.3