Fixed #3441 (segmentation fault of cppcheck (%: return ; ()))

This commit is contained in:
PKEuS 2011-12-23 12:46:59 +01:00 committed by Daniel Marjamäki
parent df8504f0ea
commit 409364747c
2 changed files with 5 additions and 0 deletions

View File

@ -1627,6 +1627,9 @@ void CheckOther::checkUnreachableCode()
tok = Token::findmatch(secondBreak, "[}:]"); tok = Token::findmatch(secondBreak, "[}:]");
} else } else
tok = secondBreak; tok = secondBreak;
if (!tok)
break;
} }
} }
} }

View File

@ -1914,6 +1914,8 @@ private:
" virtual void foo1 (P & Val) throw ();\n" " virtual void foo1 (P & Val) throw ();\n"
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("%: return ; ()"); // Don't crash. #3441.
} }