Skip to content

Commit

Permalink
TEX_InitFromWad: Fix reversing mistake (Don't add file handle before …
Browse files Browse the repository at this point in the history
…check)
  • Loading branch information
s1lentq committed Jan 31, 2024
1 parent 63fde22 commit a7b6045
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rehlds/engine/textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a7b6045

Please sign in to comment.