on xenial help sign in
less warnings about menuData being null
commita5d67480e388b9ac9b51b77fae547d020340f9f5 authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 23 Feb 2017, 14:19 (10 years ago) parent253230c
1 file changed+6−6
qml/ApplicationMenus/MenuItem.qml+6−6
qml/ApplicationMenus/MenuItem.qml+6−6
@@ -34,7 +34,7 @@ ActionItem {
3434 val += units.gu(1) + title.contentWidth;
3535 if (hasSubmenu) {
3636 val += units.gu(1) + chevronIcon.width;
37− } else if (menuData.shortcut != undefined) {
37+ } else if (menuData && menuData.shortcut != undefined) {
3838 val += units.gu(3) + shortcutLabel.contentWidth;
3939 }
4040 return val + units.gu(1);
@@ -49,9 +49,9 @@ ActionItem {
4949 enabled: root.enabled
5050
5151 // FIXME - SDK Action:text modifies menu text with html underline for mnemonic
52− text: menuData.label.replace("_", "&").replace("<u>", "&").replace("</u>", "")
53− checkable: menuData.isCheck || menuData.isRadio
54− checked: menuData.isToggled
52+ text: menuData ? menuData.label.replace("_", "&").replace("<u>", "&").replace("</u>", "") : ""
53+ checkable: menuData && (menuData.isCheck || menuData.isRadio)
54+ checked: menuData && menuData.isToggled
5555 }
5656
5757 width: {
@@ -127,8 +127,8 @@ ActionItem {
127127 color: enabled ? theme.palette.normal.overlaySecondaryText :
128128 theme.palette.disabled.overlaySecondaryText
129129
130− visible: menuData.shortcut != undefined && !root.hasSubmenu && QuickUtils.keyboardAttached
131− text: menuData.shortcut ? menuData.shortcut : ""
130+ visible: menuData && menuData.shortcut != undefined && !root.hasSubmenu && QuickUtils.keyboardAttached
131+ text: menuData && menuData.shortcut ? menuData.shortcut : ""
132132 }
133133 }
134134