forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user