diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp index e6bf3a6f9f562..5ad0cdd995ed9 100644 --- a/tools/aapt2/cmd/Link.cpp +++ b/tools/aapt2/cmd/Link.cpp @@ -574,6 +574,11 @@ bool ResourceFileFlattener::Flatten(ResourceTable* table, IArchiveWriter* archiv if (file_op.xml_to_flatten) { std::vector> versioned_docs = LinkAndVersionXmlFile(table, &file_op); + if (versioned_docs.empty()) { + error = true; + continue; + } + for (std::unique_ptr& doc : versioned_docs) { std::string dst_path = file_op.dst_path; if (doc->file.config != file_op.config) {