Merge pull request #253 from MyLittleRobo/menu_action_segfault_fix

Fix segfault when MenuItem does not have Action
This commit is contained in:
Vadim Lopatin 2016-04-29 19:00:58 +04:00
commit bf024b9ba1
1 changed files with 2 additions and 2 deletions

View File

@ -211,7 +211,7 @@ class MenuItem {
}
/// returns item label
@property UIString label() {
return _action.labelValue;
return _action !is null ? _action.labelValue : UIString("");
}
/// returns item action
@property const(Action) action() const { return _action; }
@ -372,7 +372,7 @@ class MenuItemWidget : WidgetGroupDefaultDrawing {
_item = item;
styleId = STYLE_MENU_ITEM;
updateState();
string iconId = _item.action.iconId;
string iconId = _item.action !is null ? _item.action.iconId : "";
if (_item.type == MenuItemType.Check)
iconId = "btn_check";
else if (_item.type == MenuItemType.Radio)