Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed May 17, 2023
1 parent 17bc0fb commit daabc90
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/r_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ void R_InitTextures (void)
printf("\nWarning: patch %.8s, index %d does not exist",name,i);
}

if (patchlookup[i] == -1 || !R_IsPatchLump(patchlookup[i]))
if (patchlookup[i] != -1 && !R_IsPatchLump(patchlookup[i]))
{
fprintf(stderr, "\nR_InitTextures: patch %.8s, index %d is invalid", name, i);
patchlookup[i] = (W_CheckNumForName)("TNT1A0", ns_sprites);
Expand Down Expand Up @@ -1153,7 +1153,6 @@ boolean R_IsPatchLump (const int lump)
int size;
int width, height;
const patch_t *patch;
const unsigned char *magic;
boolean result;

size = W_LumpLength(lump);
Expand All @@ -1165,8 +1164,7 @@ boolean R_IsPatchLump (const int lump)
patch = (const patch_t *)W_CacheLumpNum(lump, PU_CACHE);

// [FG] detect patches in PNG format early
magic = (const unsigned char *) patch;
if (magic[0] == 0x89 && magic[1] == 'P' && magic[2] == 'N' && magic[3] == 'G')
if (!memcmp(patch, "\211PNG\r\n\032\n", 8))
return false;

width = SHORT(patch->width);
Expand Down

1 comment on commit daabc90

@fabiangreffrath
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to click on "save", dammit!

Please sign in to comment.