aboutsummaryrefslogtreecommitdiff
path: root/ruby/ext/google/protobuf_c/storage.c
diff options
context:
space:
mode:
authorAdam Cozzette <acozzette@google.com>2017-12-01 10:05:19 -0800
committerAdam Cozzette <acozzette@google.com>2017-12-01 10:05:19 -0800
commit0ba8eea655a5e40d19ab95c773192b5d908c5a61 (patch)
tree4c2c97ade1ab197d361c146bacae5adde55986bf /ruby/ext/google/protobuf_c/storage.c
parent92a7e778e7394386f413cec28d67a07630f784b1 (diff)
parenta711e3d5b4ee1dd7f9d21197dca8432a5819a64e (diff)
downloadprotobuf-0ba8eea655a5e40d19ab95c773192b5d908c5a61.tar.gz
protobuf-0ba8eea655a5e40d19ab95c773192b5d908c5a61.tar.bz2
protobuf-0ba8eea655a5e40d19ab95c773192b5d908c5a61.zip
Merge branch 'master' into down-integrate
Diffstat (limited to 'ruby/ext/google/protobuf_c/storage.c')
-rw-r--r--ruby/ext/google/protobuf_c/storage.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/ruby/ext/google/protobuf_c/storage.c b/ruby/ext/google/protobuf_c/storage.c
index 24064dfd..1437c0b5 100644
--- a/ruby/ext/google/protobuf_c/storage.c
+++ b/ruby/ext/google/protobuf_c/storage.c
@@ -606,12 +606,20 @@ static void check_repeated_field_type(VALUE val, const upb_fielddef* field) {
rb_raise(rb_eTypeError, "Repeated field array has wrong element type");
}
- if (self->field_type == UPB_TYPE_MESSAGE ||
- self->field_type == UPB_TYPE_ENUM) {
+ if (self->field_type == UPB_TYPE_MESSAGE) {
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");
+ "Repeated field array has wrong message class");
+ }
+ }
+
+
+ if (self->field_type == UPB_TYPE_ENUM) {
+ if (self->field_type_class !=
+ EnumDescriptor_enummodule(get_def_obj(upb_fielddef_subdef(field)))) {
+ rb_raise(rb_eTypeError,
+ "Repeated field array has wrong enum class");
}
}
}