diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2019-12-06 12:20:21 -0800 |
---|---|---|
committer | Michele <mberionne@google.com> | 2019-12-06 13:05:44 -0800 |
commit | 4e19c48a6e741c96956240e96046d5baaa77be3d (patch) | |
tree | 20d523602de7ed4477cccf68bb16a9031978b7a1 /tools/aapt2/java/JavaClassGenerator.cpp | |
parent | 6572dcfaa01fae9fd6a5e1d99f1461b81a8b7983 (diff) |
Fix aapt2 JavaClassGenerator Maybe#value() call before check
Previous refactor accidentally assumed all attributes would have
resolvable symbols when generating the R class. Restore previous
behavior of calling SkipSymbol before retrieving the attribute
comment.
Bug: 145685954
Test: m TeleService
Change-Id: Ie8e1092556bc0b6a764462ffa0b99a876bcbd70e
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
-rw-r--r-- | tools/aapt2/java/JavaClassGenerator.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator.cpp b/tools/aapt2/java/JavaClassGenerator.cpp index 31d205e1b9c9..5b90d8d31db7 100644 --- a/tools/aapt2/java/JavaClassGenerator.cpp +++ b/tools/aapt2/java/JavaClassGenerator.cpp @@ -304,9 +304,11 @@ void JavaClassGenerator::ProcessStyleable(const ResourceNameRef& name, const Res auto documentation_remove_iter = std::remove_if(documentation_attrs.begin(), documentation_attrs.end(), [&](StyleableAttr entry) -> bool { - StringPiece attr_comment_line = entry.symbol.value().attribute->GetComment(); - return SkipSymbol(entry.symbol) || attr_comment_line.contains("@removed") - || attr_comment_line.contains("@hide"); + if (SkipSymbol(entry.symbol)) { + return true; + } + const StringPiece attr_comment_line = entry.symbol.value().attribute->GetComment(); + return attr_comment_line.contains("@removed") || attr_comment_line.contains("@hide"); }); documentation_attrs.erase(documentation_remove_iter, documentation_attrs.end()); |