PECallFunction: Handle empty parameters in has_aa_term() and declare_implicit_nets()

A function parameter can be an empty value, in which case its expression is
a nullptr and can not be dereferenced. Make sure this case is handled in
the has_aa_term() and declare_implicit_nets() methods.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2023-01-03 08:08:09 -08:00
parent c90265351b
commit aea202b2e9
1 changed files with 4 additions and 2 deletions

View File

@ -286,7 +286,8 @@ PECallFunction::~PECallFunction()
void PECallFunction::declare_implicit_nets(LexicalScope*scope, NetNet::Type type)
{
for (unsigned idx = 0 ; idx < parms_.size() ; idx += 1) {
parms_[idx]->declare_implicit_nets(scope, type);
if (parms_[idx])
parms_[idx]->declare_implicit_nets(scope, type);
}
}
@ -294,7 +295,8 @@ bool PECallFunction::has_aa_term(Design*des, NetScope*scope) const
{
bool flag = false;
for (unsigned idx = 0 ; idx < parms_.size() ; idx += 1) {
flag = parms_[idx]->has_aa_term(des, scope) || flag;
if (parms_[idx])
flag |= parms_[idx]->has_aa_term(des, scope);
}
return flag;
}