weston-test: check if resource is not NULL

and post client_no_memory if is...

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/tests/weston-test.c b/tests/weston-test.c
index ca2f219..f1e45c1 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -251,6 +251,11 @@
 	struct wl_resource *resource;
 
 	resource = wl_resource_create(client, &wl_test_interface, 1, id);
+	if (!resource) {
+		wl_client_post_no_memory(client);
+		return;
+	}
+
 	wl_resource_set_implementation(resource,
 				       &test_implementation, test, NULL);