Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 3dbfb42

Browse files
committed
Protect against resolve call on empty location.
1 parent 0c7ba63 commit 3dbfb42

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ public override void HandleToolTipRequest(ToolTipRequestEventArgs e)
633633
return;
634634
if (CurrentStackFrame == null)
635635
return;
636+
if (e.InDocument)
637+
return;
636638
var resolveResult = SD.ParserService.Resolve(e.Editor, e.LogicalPosition, CurrentStackFrame.AppDomain.Compilation);
637639
if (resolveResult == null)
638640
return;

src/Main/SharpDevelop/Parser/ParserService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public ResolveResult Resolve(ITextEditor editor, TextLocation location, ICompila
278278
public ResolveResult Resolve(FileName fileName, TextLocation location, ITextSource fileContent, ICompilation compilation, CancellationToken cancellationToken)
279279
{
280280
var entry = GetFileEntry(fileName, true);
281-
if (entry.parser == null)
281+
if (entry.parser == null || location.IsEmpty)
282282
return ErrorResolveResult.UnknownError;
283283
IProject project = compilation != null ? compilation.GetProject() : null;
284284
var parseInfo = entry.Parse(fileContent, project, cancellationToken);
@@ -334,7 +334,7 @@ public ResolveResult ResolveSnippet(FileName fileName, TextLocation fileLocation
334334
public Task<ResolveResult> ResolveAsync(FileName fileName, TextLocation location, ITextSource fileContent, ICompilation compilation, CancellationToken cancellationToken)
335335
{
336336
var entry = GetFileEntry(fileName, true);
337-
if (entry.parser == null)
337+
if (entry.parser == null || location.IsEmpty)
338338
return Task.FromResult<ResolveResult>(ErrorResolveResult.UnknownError);
339339
IProject project = compilation != null ? compilation.GetProject() : null;
340340
return entry.ParseAsync(fileContent, project, cancellationToken).ContinueWith(

0 commit comments

Comments
 (0)