bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a4ef152361540983152077f1e23f692b83fb5fc7

commit a4ef152361540983152077f1e23f692b83fb5fc7
Author: Marcel Hollerbach <[email protected]>
Date:   Mon Apr 6 12:35:44 2020 +0200

    ecore_evas_cocoa: be aware of NULL data
    
    this will now result in the promise beeing rejected.
    
    Reviewed-by: Mike Blumenkrantz <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D11653
---
 src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c 
b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
index 51fe657f39..7018a66691 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -514,10 +514,11 @@ _ecore_evas_cocoa_selection_request(Ecore_Evas *ee 
EINA_UNUSED, unsigned int sea
      {
         int size;
         void *data;
-        Eina_Content *content;
+        Eina_Content *content = NULL;
         Eina_Rw_Slice slice;
 
         data = ecore_cocoa_clipboard_get(&size, mime_type);
+
         if (eina_str_has_prefix(mime_type,"text"))
           {
              //ensure that we always have a \0 at the end, there is no 
assertion that \0 is included here.
@@ -530,7 +531,8 @@ _ecore_evas_cocoa_selection_request(Ecore_Evas *ee 
EINA_UNUSED, unsigned int sea
              slice.len = size;
              slice.mem = data;
           }
-        content = eina_content_new(eina_rw_slice_slice_get(slice), mime_type);
+        if (slice.mem)
+          content = eina_content_new(eina_rw_slice_slice_get(slice), 
mime_type);
         free(slice.mem); //memory got duplicated in eina_content_new
         if (!content) // construction can fail because of some validation 
reasons
           eina_promise_reject(promise, ecore_evas_no_matching_type);

-- 


Reply via email to