Browse Source

r7444@daniel-notebook (orig r3406): daniel | 2008-08-17 17:38:11 +0200

CurrentLineBookmark: add check that marker is placed inside the document. Fixed a crash when debugging code containing #line statements referencing non-existing lines.


git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3416 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
0c0d7c7ccd
  1. 11
      src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs

11
src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs

@ -42,7 +42,18 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -42,7 +42,18 @@ namespace ICSharpCode.SharpDevelop.Debugging
endLine = makerEndLine;
endColumn = makerEndColumn;
if (startLine < 1 || startLine > document.TotalNumberOfLines)
return;
if (endLine < 1 || endLine > document.TotalNumberOfLines) {
endLine = startLine;
endColumn = int.MaxValue;
}
if (startColumn < 1)
startColumn = 1;
LineSegment line = document.GetLineSegment(startLine - 1);
if (endColumn < 1 || endColumn > line.Length)
endColumn = line.Length;
instance = new CurrentLineBookmark(fileName, document, new TextLocation(startColumn - 1, startLine - 1));
document.BookmarkManager.AddMark(instance);
document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine - 1, endLine - 1));

Loading…
Cancel
Save