From cf8f7e890a247a8e928229b094ad739800aa9288 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Mon, 10 Mar 2014 20:49:39 +0100 Subject: [PATCH] Fix ArgumentNullException due to null filename when stepping in debugger. --- src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs | 2 ++ .../Workbench/DisplayBinding/DisplayBindingService.cs | 4 ++++ src/Main/SharpDevelop/Workbench/FileService.cs | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs b/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs index 3722a8c11b..5a10c9f4af 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs @@ -661,6 +661,8 @@ namespace ICSharpCode.SharpDevelop.Services public override void JumpToCurrentLine(string sourceFullFilename, int startLine, int startColumn, int endLine, int endColumn) { + if (string.IsNullOrEmpty(sourceFullFilename)) + return; IViewContent viewContent = FileService.OpenFile(sourceFullFilename); if (viewContent != null) { IPositionable positionable = viewContent.GetService(); diff --git a/src/Main/SharpDevelop/Workbench/DisplayBinding/DisplayBindingService.cs b/src/Main/SharpDevelop/Workbench/DisplayBinding/DisplayBindingService.cs index 5defa175df..1838d977c9 100644 --- a/src/Main/SharpDevelop/Workbench/DisplayBinding/DisplayBindingService.cs +++ b/src/Main/SharpDevelop/Workbench/DisplayBinding/DisplayBindingService.cs @@ -99,6 +99,8 @@ namespace ICSharpCode.SharpDevelop.Workbench public IDisplayBinding GetBindingPerFileName(FileName filename) { SD.MainThread.VerifyAccess(); + if (filename == null) + return null; if (FileUtility.IsUrl(filename)) { // The normal display binding dispatching code can't handle URLs (e.g. because it uses Path.GetExtension), // so we'll directly return the browser display binding. @@ -115,6 +117,8 @@ namespace ICSharpCode.SharpDevelop.Workbench { SD.MainThread.VerifyAccess(); + if (filename == null) + return null; string defaultCommandID = displayBindingServiceProperties.Get("Default" + Path.GetExtension(filename).ToLowerInvariant(), string.Empty); if (!string.IsNullOrEmpty(defaultCommandID)) { foreach (DisplayBindingDescriptor binding in bindings) { diff --git a/src/Main/SharpDevelop/Workbench/FileService.cs b/src/Main/SharpDevelop/Workbench/FileService.cs index 906ea2cc8d..41a18fb0ff 100644 --- a/src/Main/SharpDevelop/Workbench/FileService.cs +++ b/src/Main/SharpDevelop/Workbench/FileService.cs @@ -304,6 +304,8 @@ namespace ICSharpCode.SharpDevelop.Workbench /// public IViewContent OpenFile(FileName fileName, bool switchToOpenedView) { + if (fileName == null) + throw new ArgumentNullException("fileName"); LoggingService.Info("Open file " + fileName); IViewContent viewContent = GetOpenFile(fileName);