ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6fb17825768c623a1ec84608b8d0830393b1ce83

commit 6fb17825768c623a1ec84608b8d0830393b1ce83
Author: Andy Williams <a...@andywilliams.me>
Date:   Thu Mar 30 23:20:22 2017 +0100

    elm_code: Fix newline crash on BSD
    
    @fix
---
 src/lib/elementary/elm_code_widget.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lib/elementary/elm_code_widget.c 
b/src/lib/elementary/elm_code_widget.c
index 9a5b993..d9d7af3 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -613,7 +613,8 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, 
Elm_Code_Widget_Data *pd,
 {
    Elm_Code *code;
    Elm_Code_Line *line_obj;
-   unsigned int oldrow, position;
+   unsigned int oldrow, position, length;
+   const char *text;
 
    oldrow = pd->cursor_line;
    pd->cursor_col = col;
@@ -622,7 +623,8 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, 
Elm_Code_Widget_Data *pd,
    code = pd->code;
    line_obj = elm_code_file_line_get(code->file, line);
    position = elm_code_widget_line_text_position_for_column_get(widget, 
line_obj, col);
-   if (elm_code_line_text_get(line_obj, NULL)[position] == '\t')
+   text = elm_code_line_text_get(line_obj, &length);
+   if (position < length && text[position] == '\t')
      pd->cursor_col = 
elm_code_widget_line_text_column_width_to_position(widget, line_obj, position);
 
    if (!was_key)

-- 


Reply via email to