compositor: check queryString success
authorPekka Paalanen <ppaalanen@gmail.com>
Thu, 12 Apr 2012 11:45:35 +0000 (14:45 +0300)
committerPekka Paalanen <ppaalanen@gmail.com>
Tue, 17 Apr 2012 11:36:00 +0000 (14:36 +0300)
During a bring-up of a new backend, it would be nice to get a real error
message, when the EGL and GL contexts have not been properly set up.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
src/compositor.c

index e0cba67..ac5e91c 100644 (file)
@@ -2380,6 +2380,11 @@ weston_compositor_init(struct weston_compositor *ec, struct wl_display *display)
                (void *) eglGetProcAddress("eglUnbindWaylandDisplayWL");
 
        extensions = (const char *) glGetString(GL_EXTENSIONS);
+       if (!extensions) {
+               fprintf(stderr, "Retrieving GL extension string failed.\n");
+               return -1;
+       }
+
        if (!strstr(extensions, "GL_EXT_texture_format_BGRA8888")) {
                fprintf(stderr,
                        "GL_EXT_texture_format_BGRA8888 not available\n");
@@ -2396,6 +2401,11 @@ weston_compositor_init(struct weston_compositor *ec, struct wl_display *display)
 
        extensions =
                (const char *) eglQueryString(ec->display, EGL_EXTENSIONS);
+       if (!extensions) {
+               fprintf(stderr, "Retrieving EGL extension string failed.\n");
+               return -1;
+       }
+
        if (strstr(extensions, "EGL_WL_bind_wayland_display"))
                ec->has_bind_display = 1;
        if (ec->has_bind_display)