window: add null checks
window: add null checks

Also check for invalid parameters early on, so if we crash,
we know *why* we crashed.

sir-murray/wayland,giucam/weston,eyolfson/wayland,udoprog/weston,Tarnyko/weston-xdg_surface_present,mchalupa/wayland,xorgy/weston,abooij/wayland,eyolfson/weston,Fantu/compositor-spice,sir-murray/wayland,krezovic/weston,Gnurou/weston,mchalupa/weston,sir-murray/weston,tulcod/wayland,kwm81/weston,bitfactor/wayland,xorgy/weston,jonnylamb/weston,tulcod/wayland,eyolfson/wayland,bitfactor/wayland,jonnylamb/weston,Gnurou/weston,eyolfson/wayland,sir-murray/wayland,mchalupa/wayland,udoprog/weston,abooij/wayland,Tarnyko/weston-xdg_surface_present,kwm81/weston,mchalupa/wayland,sir-murray/weston,abooij/wayland,bitfactor/wayland,Fantu/compositor-spice,tulcod/wayland,eyolfson/weston,giucam/weston,mchalupa/weston,krezovic/weston,Fantu/compositor-spice