Skip to content

Commit

Permalink
Fix potential crash when initializing widescreen HUD
Browse files Browse the repository at this point in the history
Occurs in KDiKDiZD.
  • Loading branch information
bradharding committed Nov 20, 2024
1 parent f0db099 commit 77dc4a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ void HU_Init(void)

if (state->sprite == sprite)
{
weaponinfo[i].ammopatch = W_CacheLumpNum(firstspritelump
+ sprites[state->sprite].spriteframes[state->frame & FF_FRAMEMASK].lump[0]);
spriteframe_t *frame = &sprites[sprite].spriteframes[state->frame & FF_FRAMEMASK];

if (frame)
weaponinfo[i].ammopatch = W_CacheLumpNum(firstspritelump + frame->lump[0]);

break;
}
}
Expand Down

0 comments on commit 77dc4a1

Please sign in to comment.