From b2946f4f1ea0f99683cc3a82aa57727b45e21c12 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 18 Jul 2019 18:54:10 +0200 Subject: [PATCH] egl_swap_buffers - be safer --- gfx/common/egl_common.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index b7476a05ab..1e13b6456f 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -163,12 +163,11 @@ void egl_bind_hw_render(egl_ctx_data_t *egl, bool enable) void egl_swap_buffers(void *data) { egl_ctx_data_t *egl = (egl_ctx_data_t*)data; - - if (egl->dpy == EGL_NO_DISPLAY) - return; - if (egl->surf == EGL_NO_SURFACE) - return; - eglSwapBuffers(egl->dpy, egl->surf); + if ( egl && + egl->dpy != EGL_NO_DISPLAY && + egl->surf != EGL_NO_SURFACE + ) + eglSwapBuffers(egl->dpy, egl->surf); } void egl_set_swap_interval(egl_ctx_data_t *egl, int interval)