summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-01-15 23:50:37 +0000
committerAndy Williams <andy@andywilliams.me>2017-01-15 23:50:37 +0000
commitde92b55e32c278201e02f272433277ad73aa4f48 (patch)
treefc8719c3db76f3bb4c629dd1c670dae798cad195 /src
parentd86143212a26d7dda5df27f758a2d610435c1bb8 (diff)
elm_code: Add some safety
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/elm_code_widget.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 6131fcad80..9e06e523f2 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -107,6 +107,9 @@ _elm_code_widget_cell_size_get(Elm_Code_Widget *widget, Evas_Coord *width, Evas_
107 pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); 107 pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
108 108
109 grid = eina_list_nth(pd->grids, 0); 109 grid = eina_list_nth(pd->grids, 0);
110 if (!grid)
111 return;
112
110 evas_object_textgrid_cell_size_get(grid, &w, &h); 113 evas_object_textgrid_cell_size_get(grid, &w, &h);
111 if (w == 0) w = 5; 114 if (w == 0) w = 5;
112 if (h == 0) h = 10; 115 if (h == 0) h = 10;
@@ -337,6 +340,8 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Line *line)
337 Evas_Textgrid_Cell *cells; 340 Evas_Textgrid_Cell *cells;
338 Elm_Code_Widget_Data *pd; 341 Elm_Code_Widget_Data *pd;
339 342
343 EINA_SAFETY_ON_NULL_RETURN(line);
344
340 pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); 345 pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
341 gutter = elm_obj_code_widget_text_left_gutter_width_get(widget); 346 gutter = elm_obj_code_widget_text_left_gutter_width_get(widget);
342 if (eina_list_count(pd->grids) < line->number) 347 if (eina_list_count(pd->grids) < line->number)
@@ -405,7 +410,8 @@ _elm_code_widget_fill_range(Elm_Code_Widget *widget, unsigned int first_row, uns
405 { 410 {
406 line = elm_code_file_line_get(pd->code->file, y); 411 line = elm_code_file_line_get(pd->code->file, y);
407 412
408 _elm_code_widget_fill_line(widget, line); 413 if (line)
414 _elm_code_widget_fill_line(widget, line);
409 } 415 }
410} 416}
411 417