From 29b46cb505a580ce278cdb0e316d1f4427b86528 Mon Sep 17 00:00:00 2001 From: Alexander Mai Date: Fri, 5 Sep 2014 20:03:34 +0200 Subject: [PATCH] #6132 crash: daca: kvirc CheckOther::checkRedundantAssignment() --- lib/checkother.cpp | 2 +- test/testother.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index a22ed3229..62f69286a 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -594,7 +594,7 @@ void CheckOther::checkRedundantAssignment() std::set initialized; const Token* writtenArgumentsEnd = 0; - for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) { + for (const Token* tok = scope->classStart->next(); tok && tok != scope->classEnd; tok = tok->next()) { if (tok == writtenArgumentsEnd) writtenArgumentsEnd = 0; diff --git a/test/testother.cpp b/test/testother.cpp index c693919e2..2b221dbdf 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1945,6 +1945,17 @@ private: " s->dyn_ltree[0].fc.freq++;\n" "}\n", 0, false, false, false, false); ASSERT_EQUALS("", errout.str()); + + // Ticket #6132 "crash: daca: kvirc CheckOther::checkRedundantAssignment()" + check("void HttpFileTransfer :: transferTerminated ( bool bSuccess@1 ) {\n" + "if ( m_szCompletionCallback . isNull ( ) ) {\n" + "KVS_TRIGGER_EVENT ( KviEvent_OnHTTPGetTerminated , out ? out : ( g_pApp . activeConsole ( ) ) , & vParams )\n" + "} else {\n" + "KviKvsScript :: run ( m_szCompletionCallback , out ? out : ( g_pApp . activeConsole ( ) ) , & vParams ) ;\n" + "}\n" + "}\n", 0, false, false, false, true); + ASSERT_EQUALS("", errout.str()); + } void switchRedundantOperationTest() {