elm_menu: avoid a call to NULL
authorYeongJong Lee <yj34.lee@samsung.com>
Wed, 31 Jan 2018 13:29:12 +0000 (14:29 +0100)
committerJiyoun Park <jy0703.park@samsung.com>
Tue, 3 Apr 2018 14:54:24 +0000 (23:54 +0900)
Summary: the provider_find can be called before parent_set in constructor.

Test Plan:
1. EINA_LOG_LEVELS=eo:2 elementary_test -to menu
2. check that there is no warning message about efl_provider_find

Reviewers: jpeg, bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric

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

src/lib/elementary/elm_menu.c

index 0e2bd3b..00d1b50 100644 (file)
@@ -1509,13 +1509,10 @@ _elm_menu_efl_access_selection_selected_child_get(Eo *obj EINA_UNUSED, Elm_Menu_
 EOLIAN static Efl_Object*
 _elm_menu_efl_object_provider_find(const Eo *obj, Elm_Menu_Data *pd, const Efl_Object *klass)
 {
-   Efl_Object *result;
+   if (!pd->parent)
+     return efl_provider_find(efl_super(obj, MY_CLASS), klass);
 
-   result = efl_provider_find(pd->parent, klass);
-
-   if (result) return result;
-
-   return efl_provider_find(efl_super(obj, MY_CLASS), klass);
+   return efl_provider_find(pd->parent, klass);
 }