From: DeaDDooMER Date: Thu, 19 Mar 2020 17:49:22 +0000 (+0300) Subject: opengl: fix segfault X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=4026d71c7c19a786b09ac0f41ea51bd3e1d1a784;p=flatwaifu.git opengl: fix segfault --- diff --git a/src/gl/render.c b/src/gl/render.c index c1260da..e74d6bb 100644 --- a/src/gl/render.c +++ b/src/gl/render.c @@ -1632,10 +1632,10 @@ void R_get_name (int n, char s[8]) { static short getani (char n[8]) { short i = 0; - while (i < ANIT && strncasecmp(n, anm[i][0], 8) != 0) { + while (i < ANIT - 1 && strncasecmp(n, anm[i][0], 8) != 0) { i++; } - return i < ANIT ? i + 1 : 0; + return i < ANIT - 1 ? i + 1 : 0; } int R_get_special_id (int n) { @@ -1673,7 +1673,7 @@ void R_load (char s[8], int f) { }; } else if (strncasecmp(s, "_WATER_", 7) == 0) { walp[max_textures] = (image) { - .n = (void*)(s[7] - '0' + 1), + .n = (void*)((intptr_t)s[7] - '0' + 1), .x = 0, .y = 0, .w = 8,