summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward O'Callaghan <funfunctor@folklore1984.net>2017-02-27 11:42:53 +1100
committerEdward O'Callaghan <funfunctor@folklore1984.net>2017-02-27 11:42:53 +1100
commit90b3a7b33bcb55bb345d66d1ac075e0ae4e84800 (patch)
treea30469c979e4bb9d3e45f22269be30691273326c /src
parentff015da9777de39db0a010dec2d0833ceba2165b (diff)
src/egl.c: error check eglCreateWindowSurface() call
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Diffstat (limited to 'src')
-rw-r--r--src/egl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/egl.c b/src/egl.c
index 244bd67..c83c7cd 100644
--- a/src/egl.c
+++ b/src/egl.c
@@ -105,7 +105,13 @@ void init_egl(struct display * d)
if (!d->egl_ctx)
fprintf(stderr, "cannot create EGL context\n");
- d->egl_surface = eglCreateWindowSurface(d->egl_display, d->egl_conf, (EGLNativeWindowType)d->dev->gbm_surface, NULL);
+ assert(d->dev->gbm_surface);
+ EGLNativeWindowType native_surface = (EGLNativeWindowType) d->dev->gbm_surface;
+ d->egl_surface = eglCreateWindowSurface(d->egl_display, d->egl_conf, native_surface, NULL);
+ if (d->egl_surface == EGL_NO_SURFACE) {
+ fprintf(stderr, "cannot create EGL surface\n");
+ assert(0);
+ }
/* connect the context to the surface */
eglMakeCurrent(d->egl_display, d->egl_surface, d->egl_surface, d->egl_ctx);