From f3f1a385941f0d854ec1d96e56f24938a246569b Mon Sep 17 00:00:00 2001 From: iain holmes Date: Fri, 19 Jul 2019 12:44:30 +0100 Subject: [IDE] Handle bindings returning null commands KeyBindingManager.Commands can return null, so handle a null return. Wrap the call to ProcessKeyEventCore in a try catch block to make sure we handle and log any other possible problems with it. Fixes VSTS #944669 --- .../MonoDevelop.Components.Commands/CommandManager.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'main') diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs index 326e5a8299..67aea3f5a5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs @@ -478,8 +478,14 @@ namespace MonoDevelop.Components.Commands } #endif // Handle the GDK key via MD commanding - if (ProcessKeyEventCore (ev)) - return true; + try { + if (ProcessKeyEventCore (ev)) { + return true; + } + } catch (Exception ex) { + LoggingService.LogInternalError ("Exception while parsing command", ex); + return false; + } #if MAC // Otherwise if we have a native first responder that is not the GdkQuartzView @@ -547,6 +553,10 @@ namespace MonoDevelop.Components.Commands return false; } + if (commands == null) { + return false; + } + var toplevelFocus = IdeApp.Workbench.HasToplevelFocus; var conflict = new List (); -- cgit v1.2.3