2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-27 05:58:04 +03:00

TEX_InitFromWad: Fix reversing mistake (Don't add file handle before check)

This commit is contained in:
s1lentq 2024-01-31 15:41:00 +07:00
parent 63fde229c9
commit a7b60451f3

View File

@ -109,10 +109,10 @@ qboolean TEX_InitFromWad(char *path)
#endif // REHLDS_FIXES
texfile = FS_Open(wadPath, "rb");
texfiles[nTexFiles++] = texfile;
if (!texfile)
Sys_Error("%s: couldn't open %s\n", __func__, wadPath);
texfiles[nTexFiles++] = texfile;
Con_DPrintf("Using WAD File: %s\n", wadPath);
SafeRead(texfile, &header, 12);
if (Q_strncmp(header.identification, "WAD2", 4) && Q_strncmp(header.identification, "WAD3", 4))
@ -147,8 +147,9 @@ void TEX_CleanupWadInfo(void)
for (int i = 0; i < nTexFiles; i++)
{
FS_Close(texfiles[i]);
texfiles[i] = 0;
if (texfiles[i])
FS_Close(texfiles[i]);
texfiles[i] = NULL;
}
nTexLumps = 0;