aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-03-17 17:36:36 +0100
committerTarja Sundqvist <tarja.sundqvist@qt.io>2021-04-15 17:15:22 +0300
commita2df591e390f3730285a7d572bcebae086b96485 (patch)
tree1546dc552fa89b189270dca068bd7c39dff64a7c
parente1163220c71a6dfc326534f65ebeeade972f857c (diff)
Assert that pointer is non-null
...else the analyser gets confused. mapFn only is true when argc is greater than 2, and the second argument is actually a function. In that case, we know that mapArguments is not null, as we've called scope.alloc. Silences report 0b232fda14. Pick-to: 6.1 Change-Id: I8d20ad2fcb0b9fcc4a6451e85f61e9a63679ee26 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 5cd39d8418df74fb8e5b50fdeff591cfc951ece2)
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 1b8fbda789..27326b9fd8 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -254,6 +254,7 @@ ReturnedValue ArrayPrototype::method_from(const FunctionObject *builtin, const V
}
if (mapfn) {
+ Q_ASSERT(mapArguments); // if mapfn is set, we always setup mapArguments with scope.alloc
mapArguments[0] = *nextValue;
mapArguments[1] = Value::fromDouble(k);
mappedValue = mapfn->call(thisArg, mapArguments, 2);
@@ -297,6 +298,7 @@ ReturnedValue ArrayPrototype::method_from(const FunctionObject *builtin, const V
CHECK_EXCEPTION();
if (mapfn) {
+ Q_ASSERT(mapArguments); // if mapfn is set, we always setup mapArguments with scope.alloc
mapArguments[0] = kValue;
mapArguments[1] = Value::fromDouble(k);
mappedValue = mapfn->call(thisArg, mapArguments, 2);