diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-12-08 11:44:30 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-12-08 20:11:28 +0100 |
commit | 87d27d06543b442f1ab1c29c22a1ad4f2432034e (patch) | |
tree | 918ef72736bd5020676218bbb9654f7c488bf4b9 /src/qml/jsruntime/qv4jscall_p.h | |
parent | 43625c714079dd2be6a074f65f2eaf8355694ec3 (diff) |
QML: Don't crash when calling coerceAndCall() with null thisObject
Pick-to: 6.6 6.5
Fixes: QTBUG-119395
Change-Id: I5877beef9a53d358a6f58f9ce5029688bd9dcedb
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4jscall_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4jscall_p.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h index b76ae7d52f..fd25466d8b 100644 --- a/src/qml/jsruntime/qv4jscall_p.h +++ b/src/qml/jsruntime/qv4jscall_p.h @@ -146,10 +146,13 @@ ReturnedValue convertAndCall( values[0] = nullptr; } - if (const QV4::QObjectWrapper *cppThisObject = thisObject->as<QV4::QObjectWrapper>()) + if (const QV4::QObjectWrapper *cppThisObject = thisObject + ? thisObject->as<QV4::QObjectWrapper>() + : nullptr) { call(cppThisObject->object(), values, types, argc); - else + } else { call(nullptr, values, types, argc); + } ReturnedValue result; if (values[0]) { |