eunue pushed a commit to branch elementary-1.13.

http://git.enlightenment.org/core/elementary.git/commit/?id=637ac1cd9c0bf1d1b13c296119b07de5089c8227

commit 637ac1cd9c0bf1d1b13c296119b07de5089c8227
Author: Jaeun Choi <jaeun12.c...@samsung.com>
Date:   Tue Apr 21 14:30:41 2015 +0900

    elm: add safety check
    
    when insert a new item before/after an item, the relative item should not 
be NULL.
    this patch fixes naviframe, gengrid, genlist, list, and toolbar.
    
    @fix
---
 src/lib/elc_naviframe.c | 3 +++
 src/lib/elm_gengrid.c   | 2 ++
 src/lib/elm_genlist.c   | 2 ++
 src/lib/elm_list.c      | 2 ++
 src/lib/elm_toolbar.c   | 2 ++
 5 files changed, 11 insertions(+)

diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c
index 9781ff5..8dfd704 100644
--- a/src/lib/elc_naviframe.c
+++ b/src/lib/elc_naviframe.c
@@ -1570,6 +1570,8 @@ _elm_naviframe_item_insert_before(Eo *obj, 
Elm_Naviframe_Data *sd, Elm_Object_It
 {
    Elm_Object_Item *eo_it;
    Elm_Naviframe_Item_Data *prev_it = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL);
    ELM_NAVIFRAME_ITEM_DATA_GET(eo_before, before);
 
    ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(before, NULL);
@@ -1604,6 +1606,7 @@ _elm_naviframe_item_insert_after(Eo *obj, 
Elm_Naviframe_Data *sd, Elm_Object_Ite
    Elm_Object_Item *eo_item;
    Eina_Bool top_inserted = EINA_FALSE;
 
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL);
    ELM_NAVIFRAME_ITEM_DATA_GET(eo_after, after);
 
    ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(after, NULL);
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 80a1418..df1adce 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -3918,6 +3918,7 @@ _elm_gengrid_item_insert_before(Eo *obj, Elm_Gengrid_Data 
*sd, const Elm_Gengrid
 {
    Elm_Gen_Item *it;
    Eina_Inlist *tmp;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_relative, NULL);
    ELM_GENGRID_ITEM_DATA_GET(eo_relative, relative);
 
    ELM_GENGRID_ITEM_CHECK_OR_RETURN(relative, NULL);
@@ -3945,6 +3946,7 @@ _elm_gengrid_item_insert_after(Eo *obj, Elm_Gengrid_Data 
*sd, const Elm_Gengrid_
 {
    Elm_Gen_Item *it;
    Eina_Inlist *tmp;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_relative, NULL);
    ELM_GENGRID_ITEM_DATA_GET(eo_relative, relative);
 
    ELM_GENGRID_ITEM_CHECK_OR_RETURN(relative, NULL);
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index aefb1bb..e556876 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -6023,6 +6023,7 @@ _elm_genlist_item_prepend(Eo *obj EINA_UNUSED, 
Elm_Genlist_Data *sd, const Elm_G
 EOLIAN static Elm_Object_Item*
 _elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, 
const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item 
*eo_parent, Elm_Object_Item *eo_after, Elm_Genlist_Item_Type type, 
Evas_Smart_Cb func, const void *func_data)
 {
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL);
    ELM_GENLIST_ITEM_DATA_GET(eo_after, after);
    Elm_Gen_Item *it;
 
@@ -6069,6 +6070,7 @@ _elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, 
Elm_Genlist_Data *sd, const
 EOLIAN static Elm_Object_Item*
 _elm_genlist_item_insert_before(Eo *obj, Elm_Genlist_Data *sd, const 
Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *eo_parent, 
Elm_Object_Item *eo_before, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, 
const void *func_data)
 {
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL);
    ELM_GENLIST_ITEM_DATA_GET(eo_before, before);
    Elm_Gen_Item *it;
 
diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index 39c455d..0f361db 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -2799,6 +2799,7 @@ EOLIAN static Elm_Object_Item*
 _elm_list_item_insert_before(Eo *obj, Elm_List_Data *sd, Elm_Object_Item 
*eo_before, const char *label, Evas_Object *icon, Evas_Object *end, 
Evas_Smart_Cb func, const void *data)
 {
    Elm_List_Item_Data *it;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL);
    ELM_LIST_ITEM_DATA_GET(eo_before, before_it);
 
    ELM_LIST_ITEM_CHECK_OR_RETURN(before_it, NULL);
@@ -2817,6 +2818,7 @@ EOLIAN static Elm_Object_Item*
 _elm_list_item_insert_after(Eo *obj, Elm_List_Data *sd, Elm_Object_Item 
*eo_after, const char *label, Evas_Object *icon, Evas_Object *end, 
Evas_Smart_Cb func, const void *data)
 {
    Elm_List_Item_Data *it;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL);
    ELM_LIST_ITEM_DATA_GET(eo_after, after_it);
 
    ELM_LIST_ITEM_CHECK_OR_RETURN(after_it, NULL);
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index 6508193..92e217b 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -3069,6 +3069,7 @@ _elm_toolbar_item_insert_before(Eo *obj, Elm_Toolbar_Data 
*sd, Elm_Object_Item *
    Elm_Toolbar_Item_Data *it;
    double scale;
 
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL);
    ELM_TOOLBAR_ITEM_DATA_GET(eo_before, _before);
    ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(_before,  NULL);
 
@@ -3093,6 +3094,7 @@ _elm_toolbar_item_insert_after(Eo *obj, Elm_Toolbar_Data 
*sd, Elm_Object_Item *e
    Elm_Toolbar_Item_Data *it;
    double scale;
 
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL);
    ELM_TOOLBAR_ITEM_DATA_GET(eo_after, _after);
    ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(_after, NULL);
 

-- 


Reply via email to