Tokenizer: Avoid null pointer dereference in garbage code

This commit is contained in:
Daniel Marjamäki 2020-12-02 23:06:11 +01:00
parent 4d497712fb
commit 62810af7f3
1 changed files with 1 additions and 1 deletions

View File

@ -5185,7 +5185,7 @@ void Tokenizer::splitTemplateRightAngleBrackets(bool check)
vars.insert(tok->strAt(2));
// Ticket #6181: normalize C++11 template parameter list closing syntax
if (tok->str() == "<" && mTemplateSimplifier->templateParameters(tok) && vars.find(tok->previous()->str()) == vars.end()) {
if (tok->previous() && tok->str() == "<" && mTemplateSimplifier->templateParameters(tok) && vars.find(tok->previous()->str()) == vars.end()) {
Token *endTok = tok->findClosingBracket();
if (check) {
if (Token::Match(endTok, ">>|>>="))