From a2df591e390f3730285a7d572bcebae086b96485 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Wed, 17 Mar 2021 17:36:36 +0100 Subject: 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 Reviewed-by: Ulf Hermann (cherry picked from commit 5cd39d8418df74fb8e5b50fdeff591cfc951ece2) --- src/qml/jsruntime/qv4arrayobject.cpp | 2 ++ 1 file changed, 2 insertions(+) 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); -- cgit v1.2.3