From 50c52408f5945bf9f37329011376a3165f12cbc6 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 8 Feb 2013 23:38:05 +0000 Subject: Fix seg fault when moving cursor up onto empty top line. --- desktop/textarea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'desktop') diff --git a/desktop/textarea.c b/desktop/textarea.c index 39135b0c1..a15d64ca2 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1836,7 +1836,7 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) c_line = ta->caret_pos.line; c_chars = ta->caret_pos.char_off; - if (ta->text.data[b_off + b_len - 1] == ' ' + if (b_len > 0 && ta->text.data[b_off + b_len - 1] == ' ' && line < ta->line_count - 1) b_len--; -- cgit v1.2.3