forked from enlightenment/efl
fix segfault when there is no text in clipboard
Test Plan: cnp a clipboard content without text Reviewers: zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11565
This commit is contained in:
parent
19c57d38db
commit
e0f5e80f78
|
@ -1292,11 +1292,14 @@ _ecore_evas_win32_selection_request(Ecore_Evas *ee EINA_UNUSED, unsigned int sea
|
|||
Eina_Rw_Slice slice;
|
||||
|
||||
data = ecore_win32_clipboard_get((Ecore_Win32_Window *)ee->prop.window, &size, mime_type);
|
||||
if (size != 0)
|
||||
{
|
||||
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.
|
||||
slice.len = size + 1;
|
||||
slice.mem = eina_memdup(data, size, EINA_TRUE);
|
||||
free(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1309,6 +1312,9 @@ _ecore_evas_win32_selection_request(Ecore_Evas *ee EINA_UNUSED, unsigned int sea
|
|||
else
|
||||
eina_promise_resolve(promise, eina_value_content_init(content));
|
||||
}
|
||||
else
|
||||
eina_promise_reject(promise, ecore_evas_no_matching_type);
|
||||
}
|
||||
return future;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue