Fix SEGV on goto line when out of range

Reviewers: ajwillia.ms

Reviewed By: ajwillia.ms

Differential Revision: https://phab.enlightenment.org/D4745
This commit is contained in:
Al Poole 2017-03-25 22:08:55 +00:00 committed by Andy Williams
parent 629a293a66
commit d0997ca6a8
1 changed files with 11 additions and 3 deletions

View File

@ -632,15 +632,23 @@ edi_mainview_search()
}
void
edi_mainview_goto(int line)
edi_mainview_goto(int number)
{
Edi_Editor *editor;
Elm_Code *code;
Elm_Code_Line *line;
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
if (!editor || line <= 0)
if (!editor || number <= 0)
return;
elm_code_widget_cursor_position_set(editor->entry, line, 1);
code = elm_code_widget_code_get(editor->entry);
line = elm_code_file_line_get(code->file, number);
if (!line)
return;
elm_code_widget_cursor_position_set(editor->entry, number, 1);
elm_object_focus_set(editor->entry, EINA_TRUE);
}