Don't dereference a null pointer

If we don't specifiy an output for R.java, don't try to write
data to the class definition

Change-Id: I3ad471ec93dcb8baf13f221174065679cce311ad
Fixes: 72547268
Test: out/host/linux-x86/nativetest64/aapt2_tests/aapt2_tests
This commit is contained in:
Todd Kennedy
2018-03-02 14:19:45 -08:00
parent 11817c6bb2
commit 949b625377
3 changed files with 29 additions and 2 deletions

View File

@@ -347,7 +347,9 @@ void JavaClassGenerator::ProcessStyleable(const ResourceNameRef& name, const Res
}
// Add the Styleable array to the Styleable class.
out_class_def->AddMember(std::move(array_def));
if (out_class_def != nullptr) {
out_class_def->AddMember(std::move(array_def));
}
// Now we emit the indices into the array.
for (size_t i = 0; i < attr_count; i++) {
@@ -578,7 +580,6 @@ bool JavaClassGenerator::Generate(const StringPiece& package_name_to_generate,
if (out_r_txt != nullptr) {
r_txt_printer = util::make_unique<Printer>(out_r_txt);
}
// Generate an onResourcesLoaded() callback if requested.
if (out != nullptr && options_.rewrite_callback_options) {
rewrite_method =