Skip to content

Commit

Permalink
Add safety guards
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Oct 5, 2024
1 parent 8e35ab3 commit 88328c2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions r_phase3.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ static void R_PrepMobj(mobj_t *thing)
flip = true;
}

if (lump < firstsprite || lump >= firstsprite + numsprites)
return;

patch = W_POINTLUMPNUM(lump);
xscale = FixedDiv(PROJECTION, tz);
gzt = thing->z - vd.viewz;
Expand Down Expand Up @@ -201,6 +204,9 @@ static void R_PrepPSprite(pspdef_t *psp)
lump = sprlump[0];
patch = W_POINTLUMPNUM(lump);

if (lump < firstsprite || lump >= firstsprite + numsprites)
return;

xscale = weaponXScale;
center = centerXFrac - 80 * weaponXScale;
if (!lowResMode)
Expand Down

0 comments on commit 88328c2

Please sign in to comment.