compositor: Guard against untimely calls
It seems that sometimes these functions are called by Javascript in GNOME Shell during tear down. This causes segfaults and crash reports, but without any backtraces other than the entry and exit points into gjs.
In order to get more useful information about where these calls come from, validate the input passed gracefully, by complaining in the log and returning NULL values.