e_comp_wl_data: add NULL check of e_comp_wl_client_surface_get() 94/298094/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 31 Aug 2023 06:00:58 +0000 (15:00 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 31 Aug 2023 08:39:06 +0000 (17:39 +0900)
Change-Id: I03ec6336fc93de82773823b5e1e5ea61a7f5198f
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_comp_wl_data.c

index 042f9bd..33a905a 100644 (file)
@@ -679,10 +679,12 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, E_Dnd_Drop_Type type)
    e_comp_override_del();
    if (e_comp_wl->selection.target)
      {
-        struct wl_resource *res;
+        struct wl_resource *res = NULL;
         E_Comp_Wl_Data_Source *drag_source;
         struct wl_resource *surface = e_comp_wl_client_surface_get(e_comp_wl->selection.target);
-        res = e_comp_wl_data_find_for_client(wl_resource_get_client(surface));
+        if (surface)
+          res = e_comp_wl_data_find_for_client(wl_resource_get_client(surface));
+
         if (res)
           {
              drag_source = e_comp_wl->drag_source;
@@ -1087,6 +1089,8 @@ e_comp_wl_data_device_send_enter(E_Client *ec)
    int x, y;
 
    struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
+   if (!surface) return;
+
    data_device_res =
        e_comp_wl_data_find_for_client(wl_resource_get_client(surface));
 
@@ -1134,6 +1138,8 @@ e_comp_wl_data_device_send_leave(E_Client *ec)
    if (e_comp_wl->selection.target == ec)
      e_comp_wl->selection.target = NULL;
    struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
+   if (!surface) return;
+
    res = e_comp_wl_data_find_for_client(wl_resource_get_client(surface));
    if (res)
      wl_data_device_send_leave(res);
@@ -1146,6 +1152,8 @@ e_comp_wl_data_device_send_offer(E_Client *ec)
    E_Comp_Wl_Data_Source *source;
 
    struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
+   if (!surface) return NULL;
+
    data_device_res =
       e_comp_wl_data_find_for_client(wl_resource_get_client(surface));
    if (!data_device_res) return NULL;