summaryrefslogtreecommitdiff
path: root/upb/def.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2018-12-13 05:40:33 -0800
committerJoshua Haberman <jhaberman@gmail.com>2018-12-13 05:40:33 -0800
commit7ff8413a0317566d67b5b4abcb6ee2b72e9d465b (patch)
treea8dc1d08809103f65b1134536f01f0f4f5051e44 /upb/def.c
parent0fed529ea1795d728a7ec75c3f06d95e4ba3bd8d (diff)
Ported some tests.
Diffstat (limited to 'upb/def.c')
-rw-r--r--upb/def.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/upb/def.c b/upb/def.c
index 33ad70e..9a4d766 100644
--- a/upb/def.c
+++ b/upb/def.c
@@ -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(
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback