From 45f361e97e9324734a6d99dd5d73b7c35c0176d3 Mon Sep 17 00:00:00 2001 From: Petri Virkkunen Date: Fri, 26 Jul 2024 14:50:37 +0300 Subject: [PATCH] Android: Warn user if backend register does not have requested interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just in case, warn user if they are trying to use callInterface on an interface that does not exist (probably has not been registered) Change-Id: I1a4b2226cfecd139e36ab6386ea2fe868bd73f3f Reviewed-by: Tinja Paavoseppä (cherry picked from commit 6643e97a89f06f0c32c3dff8b2c343eaa76c0e85) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/android/androidbackendregister.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/androidbackendregister.h b/src/plugins/platforms/android/androidbackendregister.h index c186f7e107a..502880a77f3 100644 --- a/src/plugins/platforms/android/androidbackendregister.h +++ b/src/plugins/platforms/android/androidbackendregister.h @@ -43,8 +43,12 @@ public: ValidInterfaceType = true> auto callInterface(const char *func, Args... args) { - if (const auto obj = getInterface(); obj.isValid()) + if (const auto obj = getInterface(); obj.isValid()) { return obj.template callMethod(func, std::forward(args)...); + } else { + qWarning() << "No interface with className" + << QtJniTypes::Traits::className() << "has been registered."; + } if constexpr (IsObjectType::value) return Ret(QJniObject());