window: Handle data_device.selection events with offer=NULL
This happens when the current selection data_offer is removed.
diff --git a/clients/window.c b/clients/window.c
index 7ba6a22..d828725 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1866,9 +1866,11 @@
if (input->selection_offer)
data_offer_destroy(input->selection_offer);
- input->selection_offer = wl_data_offer_get_user_data(offer);
- p = wl_array_add(&input->selection_offer->types, sizeof *p);
- *p = NULL;
+ if (offer) {
+ input->selection_offer = wl_data_offer_get_user_data(offer);
+ p = wl_array_add(&input->selection_offer->types, sizeof *p);
+ *p = NULL;
+ }
}
static const struct wl_data_device_listener data_device_listener = {