window: Check for NULL surface in keyboard_handle_enter

This can happen if you right-click in weston-terminal a few times very quickly.
The pointer_handle_enter callback already checks for NULL, so let's do that in
keyboard_handle_enter, too.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
diff --git a/clients/window.c b/clients/window.c
index d75bc60..59fc07e 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3084,6 +3084,11 @@
 	struct input *input = data;
 	struct window *window;
 
+	if (!surface) {
+		/* enter event for a window we've just destroyed */
+		return;
+	}
+
 	input->display->serial = serial;
 	input->keyboard_focus = wl_surface_get_user_data(surface);