diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2017-04-20 14:31:36 -0500 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2017-12-04 19:03:22 +0000 |
commit | 11b6242ba9a0e4b680bce82243ed1bc94b1987c4 (patch) | |
tree | 6abb000481bbc52dcdc93b69b829d2d7e88c5be7 | |
parent | 55cdf69b4b70f9d954d71187a9dd85f26633befe (diff) |
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>
-rw-r--r-- | clients/editor.c | 3 | ||||
-rw-r--r-- | clients/terminal.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/clients/editor.c b/clients/editor.c index 78d10d2c..8f9eb632 100644 --- a/clients/editor.c +++ b/clients/editor.c @@ -639,6 +639,9 @@ editor_copy_cut(struct editor *editor, struct input *input, bool cut) editor->selection = display_create_data_source(editor->display); + if (!editor->selection) + return; + wl_data_source_offer(editor->selection, "text/plain;charset=utf-8"); wl_data_source_add_listener(editor->selection, diff --git a/clients/terminal.c b/clients/terminal.c index 274ced09..16a44954 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -2264,6 +2264,9 @@ terminal_copy(struct terminal *terminal, struct input *input) { terminal->selection = display_create_data_source(terminal->display); + if (!terminal->selection) + return; + wl_data_source_offer(terminal->selection, "text/plain;charset=utf-8"); wl_data_source_add_listener(terminal->selection, |