diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2018-12-13 05:40:33 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2018-12-13 05:40:33 -0800 |
commit | 7ff8413a0317566d67b5b4abcb6ee2b72e9d465b (patch) | |
tree | a8dc1d08809103f65b1134536f01f0f4f5051e44 /upb/def.c | |
parent | 0fed529ea1795d728a7ec75c3f06d95e4ba3bd8d (diff) |
Ported some tests.
Diffstat (limited to 'upb/def.c')
-rw-r--r-- | upb/def.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1359,14 +1359,21 @@ static void count_types_in_msg( size_t i; arr = google_protobuf_DescriptorProto_nested_type(msg_proto); - for (i = 0; i < upb_array_size(arr); i++) { - count_types_in_msg(upb_msgval_getptr(upb_array_get(arr, i)), counts); + if (arr) { + for (i = 0; i < upb_array_size(arr); i++) { + count_types_in_msg(upb_msgval_getptr(upb_array_get(arr, i)), counts); + } } arr = google_protobuf_DescriptorProto_enum_type(msg_proto); - counts->enum_count += upb_array_size(arr); + if (arr) { + counts->enum_count += upb_array_size(arr); + } + arr = google_protobuf_DescriptorProto_extension(msg_proto); - counts->ext_count += upb_array_size(arr); + if (arr) { + counts->ext_count += upb_array_size(arr); + } } static void count_types_in_file( |