Cure null pointer access within Scope::findFunction introduced by recent cs

This commit is contained in:
Alexander Mai 2014-11-17 23:10:00 +01:00
parent 0ba3c15c52
commit 8bcf833bb7
1 changed files with 2 additions and 1 deletions

View File

@ -3006,7 +3006,8 @@ const Function* Scope::findFunction(const Token *tok) const
// check for a match with a variable // check for a match with a variable
if (Token::Match(arguments[j], "%var% ,|)") && arguments[j]->varId()) { if (Token::Match(arguments[j], "%var% ,|)") && arguments[j]->varId()) {
const Variable * callarg = check->getVariableFromVarId(arguments[j]->varId()); const Variable * callarg = check->getVariableFromVarId(arguments[j]->varId());
if (callarg->typeStartToken()->str() == funcarg->typeStartToken()->str() && if (callarg &&
callarg->typeStartToken()->str() == funcarg->typeStartToken()->str() &&
callarg->typeStartToken()->isUnsigned() == funcarg->typeStartToken()->isUnsigned() && callarg->typeStartToken()->isUnsigned() == funcarg->typeStartToken()->isUnsigned() &&
callarg->typeStartToken()->isLong() == funcarg->typeStartToken()->isLong()) { callarg->typeStartToken()->isLong() == funcarg->typeStartToken()->isLong()) {
same++; same++;