mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:27:48 +02:00
Don't bind action if QML menu can't be added.
Otherwise eventually methods will be called on a NULL pointer. Fixes crash related to QMetaObject::invokeMethod.
This commit is contained in:
parent
acfda3ba49
commit
dabda684b8
1 changed files with 5 additions and 1 deletions
|
@ -269,7 +269,11 @@ void VrMenu::insertAction(QAction* before, QAction* action) {
|
||||||
Q_ASSERT(invokeResult);
|
Q_ASSERT(invokeResult);
|
||||||
QObject* result = reinterpret_cast<QObject*>(returnedValue); // returnedValue.value<QObject*>();
|
QObject* result = reinterpret_cast<QObject*>(returnedValue); // returnedValue.value<QObject*>();
|
||||||
Q_ASSERT(result);
|
Q_ASSERT(result);
|
||||||
bindActionToQmlAction(result, action, _rootMenu);
|
if ( result ) {
|
||||||
|
bindActionToQmlAction(result, action, _rootMenu);
|
||||||
|
} else {
|
||||||
|
qWarning() << "Failed to find addItem() method in object " << menu << ". Not inserting action " << action;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class QQuickMenuBase;
|
class QQuickMenuBase;
|
||||||
|
|
Loading…
Reference in a new issue