checkautovariable: fix #7818, crash when accessing nullpointer tok2->next().
Not test case added yet because I failed to add it as .h files to testgarbage.
This commit is contained in:
parent
2832b61a7c
commit
a5d32aa7a5
|
@ -471,7 +471,7 @@ void CheckAutoVariables::returnReference()
|
||||||
|
|
||||||
// have we reached a function that returns a reference?
|
// have we reached a function that returns a reference?
|
||||||
if (tok->previous() && tok->previous()->str() == "&") {
|
if (tok->previous() && tok->previous()->str() == "&") {
|
||||||
for (const Token *tok2 = scope->classStart->next(); tok2 && tok2 != scope->classEnd; tok2 = tok2->next()) {
|
for (const Token *tok2 = scope->classStart->next(); tok2 && tok2 != scope->classEnd && tok2->next(); tok2 = tok2->next()) {
|
||||||
if (!tok2->scope()->isExecutable()) {
|
if (!tok2->scope()->isExecutable()) {
|
||||||
tok2 = tok2->scope()->classEnd;
|
tok2 = tok2->scope()->classEnd;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue