Do NULL check before access

This commit is contained in:
Andress Barajas 2020-10-03 16:36:54 -07:00
parent 9bb1c3a9e1
commit 700b0c6389

View File

@ -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;