Guard against nullptr deref after AST-reduction consistency checks

Addresses Coverity issue 1443771
This commit is contained in:
Jon Siwek 2021-01-19 11:22:52 -08:00
parent 5bc9c818ad
commit 12f9ba5f37

View file

@ -56,9 +56,16 @@ void optimize_func(ScriptFunc* f, ProfileFunc* pf, ScopePtr scope_ptr,
non_reduced_perp = nullptr; non_reduced_perp = nullptr;
checking_reduction = true; checking_reduction = true;
if ( ! new_body->IsReduced(rc) ) if ( ! new_body->IsReduced(rc) )
printf("Reduction inconsistency for %s: %s\n", f->Name(), {
obj_desc(non_reduced_perp).c_str()); if ( non_reduced_perp )
printf("Reduction inconsistency for %s: %s\n", f->Name(),
obj_desc(non_reduced_perp).c_str());
else
printf("Reduction inconsistency for %s\n", f->Name());
}
checking_reduction = false; checking_reduction = false;
if ( analysis_options.only_func || analysis_options.dump_xform ) if ( analysis_options.only_func || analysis_options.dump_xform )