libweston: fix crash on never used output's tear-down

weston_output_enable() initializes the list, but weston_output_release()
maybe be called even if the output was never enabled, triggering the
assert due to uninitialized (actually NULL) list head.

This can be triggered with a bad weston.ini, for example using an
invalid output transform value.

Check in weston_output_disable() instead, but because it too may be
called for non-enabled output, only if it was actually enabled.

Fixes: 1a4f87dec53dcf2b44af1f935162c2cefcaad3f5
	"libweston: introduce weston_paint_node"

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 5ba909f..3fa1b8d 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -6719,9 +6719,12 @@
 	if (output->disable(output) < 0)
 		return;
 
-	if (output->enabled)
+	if (output->enabled) {
 		weston_compositor_remove_output(output);
 
+		assert(wl_list_empty(&output->paint_node_list));
+	}
+
 	output->destroying = 0;
 }
 
@@ -6816,8 +6819,6 @@
 	if (output->enabled)
 		weston_compositor_remove_output(output);
 
-	assert(wl_list_empty(&output->paint_node_list));
-
 	pixman_region32_fini(&output->region);
 	wl_list_remove(&output->link);