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

This commit is contained in:
outfoxxed 2024-07-02 10:52:11 -07:00
parent b4be383695
commit fdbb490537
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

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, [=]() {