elm_dnd: null check for safety

Also, it needs to keep backward compatibility.

Reviewed-by: Christopher Michael <devilhorns@comcast.net>
Differential Revision: https://phab.enlightenment.org/D11666
This commit is contained in:
Yeongjong Lee 2020-04-08 10:53:17 +00:00 committed by Christopher Michael
parent 7c9eb8ccf9
commit 351e9fa23f
1 changed files with 9 additions and 0 deletions

View File

@ -163,6 +163,7 @@ elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format,
Elm_Drag_Pos pos_cb, void *pos_data,
Elm_Drop_Cb drop_cb, void *drop_data)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
Elm_Drop_Target *target = calloc(1, sizeof(Elm_Drop_Target));
target->enter_cb = enter_cb;
@ -195,6 +196,8 @@ elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format,
Elm_Drop_Target *target;
Eina_List *n, *found = NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
if (!target_register)
return EINA_TRUE;
Eina_List *targets = eina_hash_find(target_register, &obj);
@ -769,6 +772,12 @@ elm_drag_start(Evas_Object *obj, Elm_Sel_Format format,
Elm_Drag_Data *dd;
const char *str_action;
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
//it should return EINA_TRUE to keep backward compatibility
if (!data)
return EINA_TRUE;
str_action = _action_to_string(action);
dd = calloc(1, sizeof(Elm_Drag_Data));
dd->dragposcb = dragpos;