#6132 crash: daca: kvirc CheckOther::checkRedundantAssignment()

This commit is contained in:
Alexander Mai 2014-09-05 20:03:34 +02:00
parent 8a15486370
commit 29b46cb505
2 changed files with 12 additions and 1 deletions

View File

@ -594,7 +594,7 @@ void CheckOther::checkRedundantAssignment()
std::set<unsigned int> 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;

View File

@ -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() {