elm_box: fix a potential null pointer dereferencing in elm_box 39/154439/3
authorWonki Kim <wonki_.kim@samsung.com>
Tue, 10 Oct 2017 07:56:44 +0000 (16:56 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Wed, 18 Oct 2017 08:38:01 +0000 (08:38 +0000)
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

Change-Id: I3bb685468cc3bdf44bddff1c51988f8ab37e7627
Signed-off-by: Wonki Kim <wonki_.kim@samsung.com>
src/lib/elm_box.c

index b7a780d..f052c38 100644 (file)
@@ -552,8 +552,11 @@ _elm_box_unpack_all(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED)
 
    ELM_BOX_CHECK(obj);
    bd = evas_object_smart_data_get(wd->resize_obj);
-   EINA_LIST_FOREACH (bd->children, l, opt)
-     _elm_widget_sub_object_redirect_to_top(obj, opt->obj);
+   if (bd)
+     {
+        EINA_LIST_FOREACH (bd->children, l, opt)
+        _elm_widget_sub_object_redirect_to_top(obj, opt->obj);
+     }
 
    /* EINA_FALSE means to delete objects as well */
    evas_object_box_remove_all(wd->resize_obj, EINA_FALSE);