desktop-shell: Return NULL when no outputs are present

Currently, get_default_output returns a first member
of the linked list, which can never be NULL.

This is problematic, as the function would return a
dangling pointer and NULL pointer checks wouldn't
work where needed and some of the invalid members
would get accessed that way, resulting in a crash.

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 2c88176..7deba55 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -688,6 +688,9 @@
 struct weston_output *
 get_default_output(struct weston_compositor *compositor)
 {
+	if (wl_list_empty(&compositor->output_list))
+		return NULL;
+
 	return container_of(compositor->output_list.next,
 			    struct weston_output, link);
 }