unreachableCode: avoid SIGSEGV when there is no "}" after return.

This commit is contained in:
Leandro Penz 2009-01-14 01:29:33 +00:00
parent 1a14cd527c
commit f33153e086
1 changed files with 3 additions and 0 deletions

View File

@ -809,6 +809,9 @@ void CheckOther::unreachableCode()
while (tok && Token::Match(tok->next(), ";"))
tok = tok->next();
if (!tok)
break;
// If there is a statement below the return it is unreachable
if (!Token::Match(tok, "; case|default|}|#") && !Token::Match(tok, "; %var% :"))
{