Attempt to fix crashes when variable valueType is nullptr. This can happen when decltype is used on unknown type

This commit is contained in:
Daniel Marjamäki 2020-11-27 16:49:25 +01:00
parent ad0eb6108b
commit d383913e1b
1 changed files with 3 additions and 1 deletions

View File

@ -964,7 +964,9 @@ void CheckClass::initializationListUsage()
const Variable* var = tok->variable(); const Variable* var = tok->variable();
if (!var || var->scope() != owner || var->isStatic()) if (!var || var->scope() != owner || var->isStatic())
continue; continue;
if (var->isPointer() || var->isReference() || var->isEnumType() || var->valueType()->type > ValueType::Type::ITERATOR) if (var->isPointer() || var->isReference() || var->isEnumType())
continue;
if (!WRONG_DATA(!var->valueType(), tok) && var->valueType()->type > ValueType::Type::ITERATOR)
continue; continue;
// bailout: multi line lambda in rhs => do not warn // bailout: multi line lambda in rhs => do not warn