aboutsummaryrefslogtreecommitdiffstatsci
path: root/CrowIDE/src/Editors/CodeBuffer/CodeBuffer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'CrowIDE/src/Editors/CodeBuffer/CodeBuffer.cs')
-rw-r--r--CrowIDE/src/Editors/CodeBuffer/CodeBuffer.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/CrowIDE/src/Editors/CodeBuffer/CodeBuffer.cs b/CrowIDE/src/Editors/CodeBuffer/CodeBuffer.cs
index 13c422a6..7d5efec9 100644
--- a/CrowIDE/src/Editors/CodeBuffer/CodeBuffer.cs
+++ b/CrowIDE/src/Editors/CodeBuffer/CodeBuffer.cs
@@ -63,7 +63,7 @@ namespace Crow.Coding
public CodeLine this[int i]
{
- get { return lines[i]; }
+ get { return i < LineCount ? lines[i] : null; }
set {
if (lines [i] == value)
return;
@@ -392,7 +392,9 @@ namespace Crow.Coding
editMutex.EnterReadLock ();
- if (value >= lines.Count)
+ if (LineCount == 0)
+ _currentLine = 0;
+ else if (value >= lines.Count)
_currentLine = lines.Count-1;
else if (value < 0)
_currentLine = 0;