Check "var" for null pointer before using it

Reported by covertey -> amai on IRC.
This commit is contained in:
Thomas Jarosch 2015-01-18 13:02:09 +01:00
parent c0aceb893e
commit a83fe0e268
1 changed files with 1 additions and 1 deletions

View File

@ -1127,7 +1127,7 @@ void CheckUnusedVar::checkFunctionVariableUsage()
unreadVariableError(usage._lastAccess, varname);
// variable has been read but not written
else if (!usage._write && !usage._allocateMemory && !var->isStlType() && var && !isEmptyType(var->type()))
else if (!usage._write && !usage._allocateMemory && var && !var->isStlType() && !isEmptyType(var->type()))
unassignedVariableError(usage._var->nameToken(), varname);
}
}