elmentary: fix a potential null pointer dereferencing in elm_box
authorWonki Kim <wonki_.kim@samsung.com>
Fri, 13 Oct 2017 19:00:59 +0000 (12:00 -0700)
committerCedric Bail <cedric@osg.samsung.com>
Fri, 13 Oct 2017 19:01:04 +0000 (12:01 -0700)
Summary:
if 'evas_object_smart_data_get' return null somehow,
logic that dereference the smart data pointer will cause problems.
This patch prevent a potential bug in advance.

Reviewers: jpeg, woohyun, cedric

Differential Revision: https://phab.enlightenment.org/D5290

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
src/lib/elementary/elm_box.c

index 5399663..4641c15 100644 (file)
@@ -475,8 +475,11 @@ _elm_box_unpack_all(Eo *obj, Elm_Box_Data *pd)
    /* set this to block _sizing_eval() calls */
    pd->delete_me = EINA_TRUE;
    bd = evas_object_smart_data_get(wd->resize_obj);
-   EINA_LIST_FOREACH (bd->children, l, opt)
-     children = eina_list_append(children, opt->obj);
+   if (bd)
+     {
+        EINA_LIST_FOREACH (bd->children, l, opt)
+          children = eina_list_append(children, opt->obj);
+     }
    pd->delete_me = EINA_FALSE;
 
    /* EINA_FALSE means do not delete objects */