e_comp_wl_data: add for null check 26/104526/1 accepted/tizen/common/20161213.164920 accepted/tizen/ivi/20161214.015819 accepted/tizen/mobile/20161214.015656 accepted/tizen/tv/20161214.015729 accepted/tizen/wearable/20161214.015752 submit/tizen/20161213.120013 submit/tizen_3.0/20161213.120123
authorGwanglim Lee <gl77.lee@samsung.com>
Tue, 13 Dec 2016 11:53:11 +0000 (20:53 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 13 Dec 2016 11:53:11 +0000 (20:53 +0900)
Change-Id: I0ecde13b346dc878acec3f63d993afabcddc5c35

src/bin/e_comp_wl_data.c

index 1c60312fac8d2b790353fc7c6a5970b76f5443c9..ecebfbd37a58c77968b76c164817829b97168bc4 100644 (file)
@@ -94,6 +94,9 @@ _e_comp_wl_data_source_cb_offer(struct wl_client *client EINA_UNUSED, struct wl_
 
    if (!source->mime_types)
      source->mime_types = eina_array_new(1);
+
+   EINA_SAFETY_ON_NULL_RETURN(source->mime_types);
+
    eina_array_push(source->mime_types, eina_stringshare_add(mime_type));
 }
 
@@ -579,7 +582,7 @@ _e_comp_wl_clipboard_source_send_send(E_Comp_Wl_Data_Source *source, const char
    if (!clip_source) return;
 
    t = eina_array_data_get(source->mime_types, 0);
-   if (!strcmp(mime_type, t))
+   if ((t) && (!strcmp(mime_type, t)))
      _e_comp_wl_clipboard_offer_create(clip_source, fd);
    else
      close(fd);
@@ -850,6 +853,9 @@ e_comp_wl_clipboard_source_create(const char *mime_type, uint32_t serial, int *f
      {
         if (!source->data_source.mime_types)
           source->data_source.mime_types = eina_array_new(1);
+
+        EINA_SAFETY_ON_NULL_RETURN_VAL(source->data_source.mime_types, NULL);
+
         eina_array_push(source->data_source.mime_types, eina_stringshare_add(mime_type));
      }