From b6cda122519fd4a51b30e9520c7f323ef2b69368 Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Fri, 13 Nov 2009 00:41:35 +0600 Subject: [PATCH] Fixed #903 (segmentation fault of cppcheck) http://sourceforge.net/apps/trac/cppcheck/ticket/903 --- lib/tokenize.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 47d1637d4..b99f04522 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3198,6 +3198,8 @@ void Tokenizer::simplifyIfAssign() if (tok3 && indentlevel == 1) { tok3 = tok3->previous(); + std::list braces2; + for (tok2 = tok2->next(); tok2 && tok2 != tok; tok2 = tok2->previous()) { tok3->insertToken(tok2->strAt(0)); @@ -3211,11 +3213,20 @@ void Tokenizer::simplifyIfAssign() { braces.push_back(newTok); } + else if (newTok->str() == "]") + { + braces2.push_back(newTok); + } else if (newTok->str() == "(") { Token::createMutualLinks(newTok, braces.back()); braces.pop_back(); } + else if (newTok->str() == "[") + { + Token::createMutualLinks(newTok, braces2.back()); + braces2.pop_back(); + } } } }