ecore_evas_cocoa: be aware of NULL data
this will now result in the promise beeing rejected. Differential Revision: https://phab.enlightenment.org/D11653
This commit is contained in:
parent
bf000ca942
commit
697f46fa76
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue