aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-01-06 16:02:08 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-01-07 08:44:17 +0100
commit09c4ec32028aff82dcec6f1c74d721f7c6279738 (patch)
tree2c2c7c0ea628da34ba309fee29abd56493e1b7a1 /src
parentf60cde61149655d004343ab97f18b3414871d75b (diff)
V4: Catch error when compiling broken RegExps
Otherwise we try to assign an invalid RegExp object, which crashes. Change-Id: I85478406524a2a9d7542758caaa1b42b4090bb93 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index c1a42c4afa..f1375e4ca4 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -961,8 +961,8 @@ ReturnedValue RegExpPrototype::method_compile(const FunctionObject *b, const Val
return scope.engine->throwTypeError();
Scoped<RegExpObject> re(scope, scope.engine->regExpCtor()->callAsConstructor(argv, argc));
-
- r->d()->value.set(scope.engine, re->value());
+ if (re) // Otherwise the regexp constructor should have thrown an exception
+ r->d()->value.set(scope.engine, re->value());
return Encode::undefined();
}