From: DeaDDooMER Date: Thu, 16 Feb 2023 19:13:06 +0000 (+0300) Subject: gl: fix crash on render finalization X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=1625a0c36ddc173078442b78c0b786f2dbd66896;p=d2df-sdl.git gl: fix crash on render finalization --- diff --git a/src/game/renders/opengl/r_textures.pas b/src/game/renders/opengl/r_textures.pas index ec47f58..97d572c 100644 --- a/src/game/renders/opengl/r_textures.pas +++ b/src/game/renders/opengl/r_textures.pas @@ -492,9 +492,12 @@ implementation begin for i := 0 to High(atl) do begin - glDeleteTextures(1, @atl[i].id); - atl[i].id := 0; - r_Common_FreeAndNil(atl[i]); + if atl[i] <> nil then + begin + glDeleteTextures(1, @atl[i].id); + atl[i].id := 0; + r_Common_FreeAndNil(atl[i]); + end; end; end; SetLength(atl, 0); @@ -503,9 +506,12 @@ implementation begin for i := 0 to High(ratl) do begin - glDeleteTextures(1, @ratl[i].id); - ratl[i].id := 0; - r_Common_FreeAndNil(ratl[i]); + if ratl[i] <> nil then + begin + glDeleteTextures(1, @ratl[i].id); + ratl[i].id := 0; + r_Common_FreeAndNil(ratl[i]); + end; end; end; SetLength(ratl, 0);