wayland/keyboard: Guard against null resource
This fixes the following abort (during shutdown with headless backend):
Thread 1 "gnome-shell" received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff7946ff1 in g_logv () from /lib64/libglib-2.0.so.0
We started hitting that abort in gnome-shell's closeWithActiveWindows
test, after the test window was ported to GTK4. It's possible that there's a GTK bug in play, but we shouldn't crash regardless.