소스 검색

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.
@rubynerd 8 년 전
부모
커밋
c64830bbca
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      ruby/ext/google/protobuf_c/storage.c

+ 1 - 1
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 ||
   if (self->field_type == UPB_TYPE_MESSAGE ||
       self->field_type == UPB_TYPE_ENUM) {
       self->field_type == UPB_TYPE_ENUM) {
     if (self->field_type_class !=
     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,
       rb_raise(rb_eTypeError,
                "Repeated field array has wrong message/enum class");
                "Repeated field array has wrong message/enum class");
     }
     }