evas: add null check logic on evas_object_smart_attach

Summary:
this commit add null check logic on evas_object_smart_attach
because a segmentation fault occurs once the argument is not valid (eg. null).

Test Plan:
	1. invoke evas_object_smart_add(obj, NULL)
	2. see the application crashes

Reviewers: woohyun, cedric

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

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
This commit is contained in:
Wonki Kim 2018-03-06 17:32:24 -08:00 committed by Cedric Bail
parent 6b29613bbe
commit 59c0246eea
1 changed files with 4 additions and 0 deletions

View File

@ -918,6 +918,10 @@ evas_object_smart_attach(Evas_Object *eo_obj, Evas_Smart *s)
Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj);
unsigned int i;
MAGIC_CHECK(s, Evas_Smart, MAGIC_SMART);
return;
MAGIC_CHECK_END();
obj->smart.smart = s;
obj->type = s->smart_class->name;
evas_object_smart_use(s);