service/tray: fix crash when display is called on a menuless item

This commit is contained in:
outfoxxed committed 2024-07-02 10:52:11 -07:00
1 parent b4be383695
commit fdbb490537
1 file changed
+6
+6
View File
@@ -109,6 +109,12 @@ void SystemTrayItem::scroll(qint32 delta, bool horizontal) const {
void SystemTrayItem::display(QObject* parentWindow, qint32 relativeX, qint32 relativeY) {
this->item->refMenu();
if (!this->item->menu()) {
this->item->unrefMenu();
qCritical() << "No menu present for" << this;
return;
}
auto* platform = new PlatformMenuEntry(&this->item->menu()->rootItem);
QObject::connect(&this->item->menu()->rootItem, &DBusMenuItem::layoutUpdated, platform, [=]() {