Check that line is not empty.

Fixes potential out of bounds access a couple of lines below.
This commit is contained in:
Hans-Albert Maritz 2015-02-15 20:05:48 +11:00
parent 06d1f31cd0
commit eaee37599f
1 changed files with 1 additions and 1 deletions

View File

@ -605,7 +605,7 @@ class EditableContent {
return res;
dstring s = line(pos.line);
int p = pos.pos;
if (p < 0 || p > s.length)
if (p < 0 || p > s.length || s.length == 0)
return res;
dchar leftChar = p > 0 ? s[p - 1] : 0;
dchar rightChar = p < s.length - 1 ? s[p + 1] : 0;