diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp index c9e272c32eaee..1afd283a430a9 100644 --- a/tools/aapt2/cmd/Link.cpp +++ b/tools/aapt2/cmd/Link.cpp @@ -1446,6 +1446,13 @@ class LinkCommand { ContainerReaderEntry* entry; ContainerReader reader(input_stream.get()); + + if (reader.HadError()) { + context_->GetDiagnostics()->Error(DiagMessage(src) + << "failed to read file: " << reader.GetError()); + return false; + } + while ((entry = reader.Next()) != nullptr) { if (entry->Type() == ContainerEntryType::kResTable) { pb::ResourceTable pb_table;