clients: Don't crash when compositor doesn't support drag and drop
display_create_data_source() can return NULL when there's no data device manager present. Instead of carrying on blindly, test its return value. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
55cdf69b4b
commit
11b6242ba9
@@ -639,6 +639,9 @@ editor_copy_cut(struct editor *editor, struct input *input, bool cut)
|
|||||||
|
|
||||||
editor->selection =
|
editor->selection =
|
||||||
display_create_data_source(editor->display);
|
display_create_data_source(editor->display);
|
||||||
|
if (!editor->selection)
|
||||||
|
return;
|
||||||
|
|
||||||
wl_data_source_offer(editor->selection,
|
wl_data_source_offer(editor->selection,
|
||||||
"text/plain;charset=utf-8");
|
"text/plain;charset=utf-8");
|
||||||
wl_data_source_add_listener(editor->selection,
|
wl_data_source_add_listener(editor->selection,
|
||||||
|
|||||||
@@ -2264,6 +2264,9 @@ terminal_copy(struct terminal *terminal, struct input *input)
|
|||||||
{
|
{
|
||||||
terminal->selection =
|
terminal->selection =
|
||||||
display_create_data_source(terminal->display);
|
display_create_data_source(terminal->display);
|
||||||
|
if (!terminal->selection)
|
||||||
|
return;
|
||||||
|
|
||||||
wl_data_source_offer(terminal->selection,
|
wl_data_source_offer(terminal->selection,
|
||||||
"text/plain;charset=utf-8");
|
"text/plain;charset=utf-8");
|
||||||
wl_data_source_add_listener(terminal->selection,
|
wl_data_source_add_listener(terminal->selection,
|
||||||
|
|||||||
Reference in New Issue
Block a user