Skip to content

Commit cf8f7e8

Browse files
committed
Fix ArgumentNullException due to null filename when stepping in debugger.
1 parent eb8f07c commit cf8f7e8

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ public override void ToggleBreakpointAt(ITextEditor editor, int lineNumber)
661661

662662
public override void JumpToCurrentLine(string sourceFullFilename, int startLine, int startColumn, int endLine, int endColumn)
663663
{
664+
if (string.IsNullOrEmpty(sourceFullFilename))
665+
return;
664666
IViewContent viewContent = FileService.OpenFile(sourceFullFilename);
665667
if (viewContent != null) {
666668
IPositionable positionable = viewContent.GetService<IPositionable>();

src/Main/SharpDevelop/Workbench/DisplayBinding/DisplayBindingService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public void RemoveExternalProcessDisplayBinding(ExternalProcessDisplayBinding bi
9999
public IDisplayBinding GetBindingPerFileName(FileName filename)
100100
{
101101
SD.MainThread.VerifyAccess();
102+
if (filename == null)
103+
return null;
102104
if (FileUtility.IsUrl(filename)) {
103105
// The normal display binding dispatching code can't handle URLs (e.g. because it uses Path.GetExtension),
104106
// so we'll directly return the browser display binding.
@@ -115,6 +117,8 @@ public DisplayBindingDescriptor GetDefaultCodonPerFileName(FileName filename)
115117
{
116118
SD.MainThread.VerifyAccess();
117119

120+
if (filename == null)
121+
return null;
118122
string defaultCommandID = displayBindingServiceProperties.Get("Default" + Path.GetExtension(filename).ToLowerInvariant(), string.Empty);
119123
if (!string.IsNullOrEmpty(defaultCommandID)) {
120124
foreach (DisplayBindingDescriptor binding in bindings) {

src/Main/SharpDevelop/Workbench/FileService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ public IViewContent OpenFile(FileName fileName)
304304
/// <inheritdoc/>
305305
public IViewContent OpenFile(FileName fileName, bool switchToOpenedView)
306306
{
307+
if (fileName == null)
308+
throw new ArgumentNullException("fileName");
307309
LoggingService.Info("Open file " + fileName);
308310

309311
IViewContent viewContent = GetOpenFile(fileName);

0 commit comments

Comments
 (0)