Fixed Cppcheck warning

This commit is contained in:
Daniel Marjamäki 2019-09-29 17:32:26 +02:00
parent 1979b64170
commit 03ff32993e
1 changed files with 5 additions and 7 deletions

View File

@ -331,14 +331,12 @@ ExprEngine::ArrayValue::ArrayValue(DataBase *data, const Variable *var)
size = std::make_shared<ExprEngine::IntRange>(std::to_string(sz), sz, sz);
}
ValuePtr val;
if (!var->isGlobal() && !var->isStatic())
if (var && !var->isGlobal() && !var->isStatic())
val = std::make_shared<ExprEngine::UninitValue>();
else {
if (var->valueType()) {
::ValueType vt(*var->valueType());
vt.pointer = 0;
val = getValueRangeFromValueType(data->getNewSymbolName(), &vt, *data->settings);
}
else if (var && var->valueType()) {
::ValueType vt(*var->valueType());
vt.pointer = 0;
val = getValueRangeFromValueType(data->getNewSymbolName(), &vt, *data->settings);
}
assign(ExprEngine::ValuePtr(), val);
}