check if AST is not null before accessing it
This commit is contained in:
parent
1aeb260a63
commit
04421f5601
|
@ -991,7 +991,7 @@ void CheckCondition::alwaysTrueFalse()
|
|||
|
||||
// Don't warn in assertions. Condition is often 'always true' by intention.
|
||||
// If platform,defines,etc cause 'always false' then that is not dangerous neither.
|
||||
const std::string &str = tok->astParent()->previous()->str();
|
||||
const std::string str = tok->astParent() && tok->astParent()->previous() ? tok->astParent()->previous()->str() : "";
|
||||
if (str.find("assert")!=std::string::npos || str.find("ASSERT")!=std::string::npos)
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue