summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
-rw-r--r--tools/aapt2/ResourceParser.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index fe401e22c50e..c291b395d94b 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -1712,7 +1712,14 @@ bool ResourceParser::ParseDeclareStyleable(xml::XmlPullParser* parser,
child_ref.SetSource(item_source);
styleable->entries.push_back(std::move(child_ref));
- out_resource->child_resources.push_back(std::move(child_resource));
+ // Do not add referenced attributes that do not define a format to the table.
+ CHECK(child_resource.value != nullptr);
+ Attribute* attr = ValueCast<Attribute>(child_resource.value.get());
+
+ CHECK(attr != nullptr);
+ if (attr->type_mask != android::ResTable_map::TYPE_ANY) {
+ out_resource->child_resources.push_back(std::move(child_resource));
+ }
} else if (!ShouldIgnoreElement(element_namespace, element_name)) {
diag_->Error(DiagMessage(item_source) << "unknown tag <"