Преглед изворни кода

Fix upb load descriptor when no messages defined in prorto. (#3080)

Paul Yang пре 8 година
родитељ
комит
de6ae7d4eb
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      php/ext/google/protobuf/upb.c

+ 3 - 0
php/ext/google/protobuf/upb.c

@@ -2290,6 +2290,9 @@ bool upb_symtab_addfile(upb_symtab *s, upb_filedef *file, upb_status *status) {
   bool ret;
   bool ret;
 
 
   n = upb_filedef_defcount(file);
   n = upb_filedef_defcount(file);
+  if (n == 0) {
+    return true;
+  }
   defs = upb_gmalloc(sizeof(*defs) * n);
   defs = upb_gmalloc(sizeof(*defs) * n);
 
 
   if (defs == NULL) {
   if (defs == NULL) {