aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4vme_moth.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-06 13:38:23 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-07 10:31:57 +0000
commitbd4064eabf79a6166805c877ee622931df6fb172 (patch)
tree9a9d96fbb224ada879836dbfb7cff9e93b44946f /src/qml/jsruntime/qv4vme_moth.cpp
parent15bdbd89639c29f88db1798de66066a4a95759c0 (diff)
Throw a type error when trying to destructure null or undefined
Change-Id: Id1bba1a729124bccb8a90dcf40252fe5c69d27a3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4vme_moth.cpp')
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index f38bd7b48e..6ed371bbf2 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -1344,6 +1344,13 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
STACK_VALUE(i) = acc;
MOTH_END_INSTR(InitializeBlockDeadTemporalZone)
+ MOTH_BEGIN_INSTR(ThrowOnNullOrUndefined)
+ if (Primitive::fromReturnedValue(acc).isNullOrUndefined()) {
+ engine->throwTypeError();
+ goto handleUnwind;
+ }
+ MOTH_END_INSTR(ThrowOnNullOrUndefined)
+
MOTH_BEGIN_INSTR(Debug)
#if QT_CONFIG(qml_debug)
STORE_IP();