compositor: Don't try and destroy old pointer surface if it empty
If attach was called on wl_input_device with a nil buffer twice then the
second call would cause a segfault.
diff --git a/src/compositor.c b/src/compositor.c
index 819cb5d..2627987 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1609,8 +1609,10 @@
weston_surface_damage_below(device->sprite);
if (!buffer_resource) {
- destroy_surface(&device->sprite->surface.resource);
- device->sprite = NULL;
+ if (device->sprite) {
+ destroy_surface(&device->sprite->surface.resource);
+ device->sprite = NULL;
+ }
return;
}