From b862d429b1010fecf2e29d0e781b012a4b07cad6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 8 Aug 2018 21:33:18 +0200 Subject: Fix some details in RegExp handling Change-Id: If9f7c07ea657ba8503b9188a7b77e301f23423ef Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4stringobject.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4stringobject.cpp') diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index de8fa0c2ee..e13accd4ea 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -799,8 +799,11 @@ ReturnedValue StringPrototype::method_replace(const FunctionObject *b, const Val break; offset = qMax(offset + 1, matchOffsets[oldSize + 1]); } - if (regExp->global()) + if (regExp->global()) { regExp->setLastIndex(0); + if (scope.hasException()) + return Encode::undefined(); + } numStringMatches = nMatchOffsets / (regExp->value()->captureCount() * 2); numCaptures = regExp->value()->captureCount(); } else { -- cgit v1.2.3