From eaee37599fe4720b3348d43e1f83c92121163886 Mon Sep 17 00:00:00 2001 From: Hans-Albert Maritz Date: Sun, 15 Feb 2015 20:05:48 +1100 Subject: [PATCH] Check that line is not empty. Fixes potential out of bounds access a couple of lines below. --- src/dlangui/core/editable.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dlangui/core/editable.d b/src/dlangui/core/editable.d index 3e9f7e31..e73f1301 100644 --- a/src/dlangui/core/editable.d +++ b/src/dlangui/core/editable.d @@ -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;