QmlJS checks: Don't crash if try has no catch or finally.

Change-Id: If7001963bc11f2fa01f058c903ee014f6acb0c04
Reviewed-on: http://codereview.qt-project.org/5102
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-09-16 15:32:47 +02:00
parent aebcc3c75b
commit b3bb5d700e

View File

@@ -371,8 +371,12 @@ protected:
virtual bool visit(TryStatement *ast)
{
State tryBody = check(ast->statement);
State catchBody = check(ast->catchExpression->statement);
State finallyBody = check(ast->finallyExpression->statement);
State catchBody = ReturnOrThrow;
if (ast->catchExpression)
catchBody = check(ast->catchExpression->statement);
State finallyBody = ReachesEnd;
if (ast->finallyExpression)
finallyBody = check(ast->finallyExpression->statement);
_state = qMax(qMin(tryBody, catchBody), finallyBody);
return false;