valueFlowContainerSize: Fix crash when container pointer is null

This commit is contained in:
Daniel Marjamäki 2018-08-10 12:53:16 +02:00
parent f37434cd1d
commit 3805af18a2
1 changed files with 1 additions and 1 deletions

View File

@ -3436,7 +3436,7 @@ static void valueFlowContainerSize(TokenList * /*tokenlist*/, SymbolDatabase* sy
if (scope.type != Scope::ScopeType::eIf) // TODO: while
continue;
for (const Token *tok = scope.classDef; tok && tok->str() != "{"; tok = tok->next()) {
if (!tok->isName() || !tok->valueType() || tok->valueType()->type != ValueType::CONTAINER)
if (!tok->isName() || !tok->valueType() || tok->valueType()->type != ValueType::CONTAINER || !tok->valueType()->container)
continue;
if (!Token::Match(tok, "%name% . %name% ("))
continue;