From: seoz Date: Tue, 2 Aug 2011 06:54:10 +0000 (+0000) Subject: elm genlist: Added more guard code and moved some codes for the X-Git-Tag: REL_F_I9500_20120323_1~17^2~2068 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ceda6558e6288dc3125cce525bde47e7e2714d9;p=framework%2Fuifw%2Felementary.git elm genlist: Added more guard code and moved some codes for the readability. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@61981 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index b7c129b..4031c58 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -3470,6 +3470,9 @@ elm_genlist_item_insert_before(Evas_Object *obj, Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, func_data); if (!it) return NULL; + /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL); + if (!it->parent) { if ((flags & ELM_GENLIST_ITEM_GROUP) && @@ -3604,8 +3607,6 @@ elm_genlist_item_insert_after(Evas_Object *obj, /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */ EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL); - wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), - EINA_INLIST_GET(after)); if (!it->parent) { if ((flags & ELM_GENLIST_ITEM_GROUP) && @@ -3618,6 +3619,8 @@ elm_genlist_item_insert_after(Evas_Object *obj, it->parent->items = eina_list_append_relative(it->parent->items, it, after); } + wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(after)); it->rel = after; it->rel->relcount++; it->before = EINA_FALSE;