Skip to content

Commit 06b8e26

Browse files
committed
ParentMenuItemBase:
- Added try\catch with logging if EvaluateCanExecute throws
1 parent 8c98cee commit 06b8e26

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

RetailCoder.VBE/UI/Command/MenuItems/ParentMenus/ParentMenuItemBase.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,16 @@ public void EvaluateCanExecute(RubberduckParserState state)
124124
var commandItem = kvp.Key as ICommandMenuItem;
125125
if (commandItem != null && kvp.Value != null)
126126
{
127-
kvp.Value.IsEnabled = commandItem.EvaluateCanExecute(state);
127+
try
128+
{
129+
kvp.Value.IsEnabled = commandItem.EvaluateCanExecute(state);
130+
}
131+
catch (Exception exception)
132+
{
133+
kvp.Value.IsEnabled = false;
134+
Logger.Error(exception, "Could not evaluate availability of commmand menu item {0}.", kvp.Value.Tag ?? "{Unknown}");
135+
}
136+
128137
}
129138
}
130139
}

0 commit comments

Comments
 (0)