Symboldatabase: Fix possible null pointer dereference if smart pointer type does not have a scope
This commit is contained in:
parent
9b674fa306
commit
862c4ef87b
|
@ -4455,10 +4455,10 @@ const Function* SymbolDatabase::findFunction(const Token *tok) const
|
||||||
const Token *tok1 = tok->tokAt(-2);
|
const Token *tok1 = tok->tokAt(-2);
|
||||||
if (Token::Match(tok1, "%var% .")) {
|
if (Token::Match(tok1, "%var% .")) {
|
||||||
const Variable *var = getVariableFromVarId(tok1->varId());
|
const Variable *var = getVariableFromVarId(tok1->varId());
|
||||||
if (var && var->smartPointerType() && tok1->next()->originalName() == "->")
|
|
||||||
return var->smartPointerType()->classScope->findFunction(tok, var->valueType()->constness == 1);
|
|
||||||
if (var && var->typeScope())
|
if (var && var->typeScope())
|
||||||
return var->typeScope()->findFunction(tok, var->valueType()->constness == 1);
|
return var->typeScope()->findFunction(tok, var->valueType()->constness == 1);
|
||||||
|
if (var && var->smartPointerType() && var->smartPointerType()->classScope && tok1->next()->originalName() == "->")
|
||||||
|
return var->smartPointerType()->classScope->findFunction(tok, var->valueType()->constness == 1);
|
||||||
} else if (Token::simpleMatch(tok->previous()->astOperand1(), "(")) {
|
} else if (Token::simpleMatch(tok->previous()->astOperand1(), "(")) {
|
||||||
const Token *castTok = tok->previous()->astOperand1();
|
const Token *castTok = tok->previous()->astOperand1();
|
||||||
if (castTok->isCast()) {
|
if (castTok->isCast()) {
|
||||||
|
|
Loading…
Reference in New Issue