aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-27 10:20:02 -0500
committerGitHub <noreply@github.com>2019-01-27 10:20:02 -0500
commit89eacf556a64512a4d6ba8241e91f1d287007ad2 (patch)
tree8aaf915772abe047efa889b5b95075d71e2fdb09
parent0772c20c7f2417d3ba6b8f1be07cce6c9e90ddf4 (diff)
parent5fdf22b5d3ca0383f72098f51a96035494089d6a (diff)
Merge pull request #1505 from emersion/data-control-unset
data-control-v1: handle NULL sources in set_selection
-rw-r--r--types/wlr_data_control_v1.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/types/wlr_data_control_v1.c b/types/wlr_data_control_v1.c
index e06b9e63..5bb7e81c 100644
--- a/types/wlr_data_control_v1.c
+++ b/types/wlr_data_control_v1.c
@@ -177,11 +177,15 @@ static void control_handle_set_selection(struct wl_client *client,
struct wl_resource *source_resource) {
struct wlr_data_control_device_v1 *device =
control_from_resource(control_resource);
- struct client_data_source *source = source_from_resource(source_resource);
if (device == NULL) {
return;
}
+ struct client_data_source *source = NULL;
+ if (source_resource != NULL) {
+ source = source_from_resource(source_resource);
+ }
+
struct wlr_data_source *wlr_source = source ? &source->source : NULL;
wlr_seat_request_set_selection(device->seat, wlr_source,
wl_display_next_serial(device->seat->display));