OSDN Git Service

矩形選択時に落ちることがあった
authorgdkhd812 <test@yahoo.co.jp>
Sat, 14 Oct 2017 13:45:46 +0000 (22:45 +0900)
committergdkhd812 <test@yahoo.co.jp>
Sat, 14 Oct 2017 13:45:46 +0000 (22:45 +0900)
Core/LineToIndex.cs

index 71dce51..ef32a08 100644 (file)
@@ -334,8 +334,12 @@ namespace FooEditEngine
         /// </summary>
         public void ClearLayoutCache(int index,int length)
         {
+            if (index >= this.Document.Length)
+                return;
             int startRow = this.GetLineNumberFromIndex(index);
             int lastIndex = Math.Min(index + length - 1, this.Document.Length - 1);
+            if (lastIndex < 0)
+                lastIndex = 0;
             int endRow = this.GetLineNumberFromIndex(lastIndex);
             for (int i = startRow; i <= endRow; i++)
                 this.Lines[i].Dispose();