Do not return error if the .proto file contain no type declarations

The missing message or enum declarations shouldn't lead to an error
when running protobuf generator. This only means that the .proto file
needs no processing.

Pick-to: 6.5 6.6
Change-Id: I80c81ebd04024c1e08883b8a0b9cf572b0c3aa1d
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
This commit is contained in:
Alexey Edelev 2023-08-12 15:24:54 +02:00
parent fa1a88fe8f
commit b94ba71cf7
1 changed files with 3 additions and 3 deletions

View File

@ -386,9 +386,9 @@ bool QProtobufGenerator::GenerateMessages(const FileDescriptor *file,
assert(file != nullptr);
assert(generatorContext != nullptr);
if (file->message_type_count() <= 0 && file->enum_type_count() <= 0) {
return false;
}
if (file->message_type_count() <= 0 && file->enum_type_count() <= 0)
return true;
GenerateHeader(file, generatorContext);
GenerateSources(file, generatorContext);
return true;