Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorMike Krüger <mikkrg@microsoft.com>2019-06-27 12:06:26 +0300
committermonojenkins <jo.shields+jenkins@xamarin.com>2019-07-03 20:45:00 +0300
commitc7377c63638b9aabdd4bbd6382c8774295364e64 (patch)
treeb1a52972eef5b06e656af047e63f9ffb908fefa4 /main
parent57decf1912817644871d679605be43371147342f (diff)
Fixes VSTS Bug 935201: System.ArgumentOutOfRangeException exception in Microsoft.VisualStudio.Text.SnapshotPoint..ctor()
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/935201 line.Start + Column - 1 will throw if Column is at EOL the - 1 is interpreted as (Start + Column) - 1. Using brackets to evaluate it differently : Start + (Column - 1) would fix the issue but I added the bounds check to prevent the exeception from happening in all cases.
Diffstat (limited to 'main')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
index ef1f5c361f..c01448bdb4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
@@ -658,10 +658,11 @@ namespace MonoDevelop.Ide.Gui.Documents
var offset = info.Offset;
if (offset < 0) {
var line = textView.TextSnapshot.GetLineFromLineNumber (info.Line - 1);
- if (info.Column >= 1)
- offset = line.Start + info.Column - 1;
- else
+ if (info.Column >= 1) {
+ offset = line.Start + Math.Min (info.Column - 1, line.Length);
+ } else {
offset = line.Start;
+ }
}
if (editorOperationsFactoryService != null) {
var editorOperations = editorOperationsFactoryService.GetEditorOperations (textView);