From 700b0c63890d859accec86c21c7d6e8b9cc78988 Mon Sep 17 00:00:00 2001 From: Andress Barajas Date: Sat, 3 Oct 2020 16:36:54 -0700 Subject: [PATCH] Do NULL check before access --- GL/framebuffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GL/framebuffer.c b/GL/framebuffer.c index 33f5a3a..96c1d43 100644 --- a/GL/framebuffer.c +++ b/GL/framebuffer.c @@ -268,14 +268,14 @@ void APIENTRY glGenerateMipmapEXT(GLenum target) { TextureObject* tex = _glGetBoundTexture(); - if(tex->width != tex->height) { - fprintf(stderr, "[GL ERROR] Mipmaps cannot be supported on non-square textures\n"); + if(!tex || !tex->data || !tex->mipmapCount) { _glKosThrowError(GL_INVALID_OPERATION, __func__); _glKosPrintError(); return; } - if(!tex || !tex->data || !tex->mipmapCount) { + if(tex->width != tex->height) { + fprintf(stderr, "[GL ERROR] Mipmaps cannot be supported on non-square textures\n"); _glKosThrowError(GL_INVALID_OPERATION, __func__); _glKosPrintError(); return;