Add safety checks to genlist and gengrid.

The insert_(before|after) functions require a relative item so let's check for
it and appropriately return if it is not given.



SVN revision: 53253
This commit is contained in:
Rafael Fonseca 2010-10-11 02:09:36 +00:00
parent 105aeb5967
commit fdcf18e462
2 changed files with 4 additions and 0 deletions

View File

@ -1556,6 +1556,7 @@ elm_gengrid_item_insert_before(Evas_Object *obj,
{
Elm_Gengrid_Item *item;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
@ -1599,6 +1600,7 @@ elm_gengrid_item_insert_after(Evas_Object *obj,
{
Elm_Gengrid_Item *item;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;

View File

@ -2184,6 +2184,7 @@ elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *i
Evas_Smart_Cb func, const void *func_data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Genlist_Item *it = _item_new(wd, itc, data, NULL, flags, func, func_data);
if (!wd) return NULL;
@ -2226,6 +2227,7 @@ elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *it
Evas_Smart_Cb func, const void *func_data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Genlist_Item *it = _item_new(wd, itc, data, NULL, flags, func, func_data);
if (!wd) return NULL;