summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2020-04-08 10:53:17 +0000
committerChristopher Michael <devilhorns@comcast.net>2020-04-08 07:25:39 -0400
commit351e9fa23f1389f33fc8cf12ab6ed18ee2f0b72b (patch)
tree8b43174af2b8e6afa24f01fd38b0ad8f97ec00cb
parent7c9eb8ccf948c6fcde8b47a442f7f682c492b828 (diff)
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
-rw-r--r--src/lib/elementary/elm_dnd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_dnd.c b/src/lib/elementary/elm_dnd.c
index 699414bb4a..bc765fdbb6 100644
--- a/src/lib/elementary/elm_dnd.c
+++ b/src/lib/elementary/elm_dnd.c
@@ -163,6 +163,7 @@ elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format,
163 Elm_Drag_Pos pos_cb, void *pos_data, 163 Elm_Drag_Pos pos_cb, void *pos_data,
164 Elm_Drop_Cb drop_cb, void *drop_data) 164 Elm_Drop_Cb drop_cb, void *drop_data)
165{ 165{
166 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
166 167
167 Elm_Drop_Target *target = calloc(1, sizeof(Elm_Drop_Target)); 168 Elm_Drop_Target *target = calloc(1, sizeof(Elm_Drop_Target));
168 target->enter_cb = enter_cb; 169 target->enter_cb = enter_cb;
@@ -195,6 +196,8 @@ elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format,
195 Elm_Drop_Target *target; 196 Elm_Drop_Target *target;
196 Eina_List *n, *found = NULL; 197 Eina_List *n, *found = NULL;
197 198
199 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
200
198 if (!target_register) 201 if (!target_register)
199 return EINA_TRUE; 202 return EINA_TRUE;
200 Eina_List *targets = eina_hash_find(target_register, &obj); 203 Eina_List *targets = eina_hash_find(target_register, &obj);
@@ -769,6 +772,12 @@ elm_drag_start(Evas_Object *obj, Elm_Sel_Format format,
769 Elm_Drag_Data *dd; 772 Elm_Drag_Data *dd;
770 const char *str_action; 773 const char *str_action;
771 774
775 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
776
777 //it should return EINA_TRUE to keep backward compatibility
778 if (!data)
779 return EINA_TRUE;
780
772 str_action = _action_to_string(action); 781 str_action = _action_to_string(action);
773 dd = calloc(1, sizeof(Elm_Drag_Data)); 782 dd = calloc(1, sizeof(Elm_Drag_Data));
774 dd->dragposcb = dragpos; 783 dd->dragposcb = dragpos;