@@ -308,28 +308,36 @@ void DBusMenu::fillLayoutProperties(
308308 : 0 ));
309309 } else {
310310 id -= builtInIds;
311- if (auto *ic = lastRelevantIc ()) {
312- if (auto *action = parent_->instance ()
313- ->userInterfaceManager ()
314- .lookupActionById (id)) {
315- appendProperty (properties, propertyNames, " label" ,
316- dbus::Variant (action->shortText (ic)));
317- appendProperty (properties, propertyNames, " icon-name" ,
318- dbus::Variant (iconName (action->icon (ic))));
319- if (action->isCheckable ()) {
320- appendProperty (properties, propertyNames, " toggle-type" ,
321- dbus::Variant (" radio" ));
322- bool checked = action->isChecked (ic);
311+ auto *ic = lastRelevantIc ();
312+ if (!ic) {
313+ return ;
314+ }
315+ auto *action =
316+ parent_->instance ()->userInterfaceManager ().lookupActionById (id);
317+ if (!action) {
318+ return ;
319+ }
320+ if (action->isSeparator ()) {
321+ appendProperty (properties, propertyNames, " type" ,
322+ dbus::Variant (" separator" ));
323+ return ;
324+ }
323325
324- appendProperty (properties, propertyNames, " toggle-state" ,
325- dbus::Variant (checked ? 1 : 0 ));
326- }
327- if (action->menu ()) {
328- appendProperty (properties, propertyNames,
329- " children-display" ,
330- dbus::Variant (" submenu" ));
331- }
332- }
326+ appendProperty (properties, propertyNames, " label" ,
327+ dbus::Variant (action->shortText (ic)));
328+ appendProperty (properties, propertyNames, " icon-name" ,
329+ dbus::Variant (iconName (action->icon (ic))));
330+ if (action->isCheckable ()) {
331+ appendProperty (properties, propertyNames, " toggle-type" ,
332+ dbus::Variant (" radio" ));
333+ bool checked = action->isChecked (ic);
334+
335+ appendProperty (properties, propertyNames, " toggle-state" ,
336+ dbus::Variant (checked ? 1 : 0 ));
337+ }
338+ if (action->menu ()) {
339+ appendProperty (properties, propertyNames, " children-display" ,
340+ dbus::Variant (" submenu" ));
333341 }
334342 }
335343}
0 commit comments