diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-22 10:48:21 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-29 10:38:57 +0100 |
commit | 2b996ca17fbc36029af3900933b6fcc1418afb6a (patch) | |
tree | 1c3712947febfedc5bb5566053ab0e7093eeabc6 /src/qml/jsapi/qjsvalueiterator.cpp | |
parent | e0284ab41f7a1889f28e719212df66e942959f4c (diff) |
Correctly catch exceptions in the API methods
Replace all C++ try/catch statements with
engine->hasException checks.
Change-Id: I7c04e02664ec6b4d256478c6e18f6b20ae4f7bc1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsapi/qjsvalueiterator.cpp')
-rw-r--r-- | src/qml/jsapi/qjsvalueiterator.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/qml/jsapi/qjsvalueiterator.cpp b/src/qml/jsapi/qjsvalueiterator.cpp index dcf7c4755b..245b75b384 100644 --- a/src/qml/jsapi/qjsvalueiterator.cpp +++ b/src/qml/jsapi/qjsvalueiterator.cpp @@ -199,21 +199,20 @@ QJSValue QJSValueIterator::value() const QV4::ScopedObject o(scope, it->it.object); QV4::ExecutionContext *ctx = engine->current; - try { - QV4::ScopedValue v(scope); - if (!!d_ptr->currentName) { - QV4::ScopedString n(scope, d_ptr->currentName); - v = o->get(n); - } else if (d_ptr->currentIndex != UINT_MAX) { - v = o->getIndexed(d_ptr->currentIndex); - } else { - return QJSValue(); - } - return new QJSValuePrivate(engine, v); - } catch (...) { + QV4::ScopedValue v(scope); + if (!!d_ptr->currentName) { + QV4::ScopedString n(scope, d_ptr->currentName); + v = o->get(n); + } else if (d_ptr->currentIndex != UINT_MAX) { + v = o->getIndexed(d_ptr->currentIndex); + } else { + return QJSValue(); + } + if (scope.hasException()) { ctx->catchException(); return QJSValue(); } + return new QJSValuePrivate(engine, v); } |