diff options
Diffstat (limited to 'src/qml/jsruntime/qv4stringobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 36d1433665..f36c7d84a4 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -597,15 +597,16 @@ ReturnedValue StringPrototype::method_search(SimpleCallContext *ctx) { Scope scope(ctx); QString string = getThisString(ctx); + ScopedValue regExpValue(scope, ctx->argument(0)); if (scope.engine->hasException) return Encode::undefined(); - - ScopedValue regExpValue(scope, ctx->argument(0)); Scoped<RegExpObject> regExp(scope, regExpValue->as<RegExpObject>()); if (!regExp) { ScopedCallData callData(scope, 1); callData->args[0] = regExpValue; regExpValue = ctx->engine->regExpCtor.asFunctionObject()->construct(callData); + if (scope.engine->hasException) + return Encode::undefined(); regExp = regExpValue->as<RegExpObject>(); Q_ASSERT(regExp); } |