aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-16 16:16:29 +0100
committeremersion <contact@emersion.fr>2017-12-16 16:16:29 +0100
commit9310d101bc81da28dbb02aac46a4c8ccb0721436 (patch)
treeafa9e035a69a9ec3f5ae31118f27d362f90865fe
parent8af6fbd7a0cfc663b61f084583b800abf6de40e3 (diff)
Fix potential segfault
-rw-r--r--types/wlr_data_device.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c
index e0053399..bd7665cf 100644
--- a/types/wlr_data_device.c
+++ b/types/wlr_data_device.c
@@ -269,9 +269,16 @@ static struct wlr_data_offer *wlr_data_source_send_offer(
}
void wlr_seat_client_send_selection(struct wlr_seat_client *seat_client) {
+ if (wl_list_empty(&seat_client->data_devices)) {
+ return;
+ }
+
if (seat_client->seat->selection_source) {
struct wlr_data_offer *offer = wlr_data_source_send_offer(
seat_client->seat->selection_source, seat_client);
+ if (offer == NULL) {
+ return;
+ }
struct wl_resource *resource;
wl_resource_for_each(resource, &seat_client->data_devices) {