elm_list: check sd not being null before access its members.

If the list is deleted/recteated the _elm_list_item_focused/unfocused() is
called and the sd pointer is null.

This unbreak all my apps that use elm_list
This commit is contained in:
Davide Andreoli 2014-03-15 22:38:12 +01:00
parent bcf8f05e73
commit f5a4489a62
1 changed files with 2 additions and 2 deletions

View File

@ -1002,7 +1002,7 @@ _elm_list_item_focused(Elm_List_Item *it)
Evas_Coord x, y, w, h, sx, sy, sw, sh;
const char *focus_raise;
if ((sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) ||
if ((!sd) || (sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) ||
(it == (Elm_List_Item *)sd->focused_item))
return;
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
@ -1027,7 +1027,7 @@ _elm_list_item_unfocused(Elm_List_Item *it)
{
ELM_LIST_DATA_GET(WIDGET(it), sd);
if (!sd->focused_item ||
if ((!sd) || (!sd->focused_item) ||
(it != (Elm_List_Item *)sd->focused_item))
return;