Fix issue detected by Coverity, vt2 is null checked and then dereferenced

This commit is contained in:
Daniel Marjamäki 2017-08-02 07:48:11 +02:00
parent d2698733c3
commit 55aec0ef1b
1 changed files with 1 additions and 1 deletions

View File

@ -4836,7 +4836,7 @@ void SymbolDatabase::setValueType(Token *tok, const ValueType &valuetype)
bool ternary = parent->str() == ":" && parent->astParent() && parent->astParent()->str() == "?"; bool ternary = parent->str() == ":" && parent->astParent() && parent->astParent()->str() == "?";
if (ternary) { if (ternary) {
if (vt1->pointer == vt2->pointer && vt1->type == vt2->type && vt1->sign == vt2->sign) if (vt2 && vt1->pointer == vt2->pointer && vt1->type == vt2->type && vt1->sign == vt2->sign)
setValueType(parent, *vt2); setValueType(parent, *vt2);
parent = const_cast<Token*>(parent->astParent()); parent = const_cast<Token*>(parent->astParent());
} }