egl/wayland: handle NULL native_window in create_surface
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 18 Jun 2015 19:19:32 +0000 (20:19 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 30 Jun 2015 16:34:31 +0000 (17:34 +0100)
Raise EGL_BAD_NATIVE_WINDOW instead of crashing.

v2: s/Rise/Raise/ (spotted by Michel)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/egl/drivers/dri2/platform_wayland.c

index 160fa8ce8d7971022a39302b5d1ed3dd72ed6ed3..6f42d90ed961727632b6d6aa2e5bcf825783dfaf 100644 (file)
@@ -149,6 +149,11 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp,
    else
       dri2_surf->format = WL_DRM_FORMAT_ARGB8888;
 
+   if (!window) {
+      _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
+      goto cleanup_surf;
+   }
+
    dri2_surf->wl_win = window;
 
    dri2_surf->wl_win->private = dri2_surf;