AAPT2: Accept empty zip files
The libziparchive returns an error on empty zip files.
Work around this by checking for that error condition and
returning an empty ZipFileCollection.
Change-Id: I9edaf2e089456b6ccb4bb099b20ede10331bd352
diff --git a/tools/aapt2/link/Link.cpp b/tools/aapt2/link/Link.cpp
index 51b9cec..364a55b 100644
--- a/tools/aapt2/link/Link.cpp
+++ b/tools/aapt2/link/Link.cpp
@@ -551,12 +551,13 @@
if (resourceFile) {
return mergeCompiledFile(file, std::move(resourceFile), override);
}
- } else {
- // Ignore non .flat files. This could be classes.dex or something else that happens
- // to be in an archive.
+
+ return false;
}
- return false;
+ // Ignore non .flat files. This could be classes.dex or something else that happens
+ // to be in an archive.
+ return true;
}
int run(const std::vector<std::string>& inputFiles) {