Add guard to prevent OOB error

This commit is contained in:
nukeykt 2019-12-15 10:48:46 +09:00 committed by Christoph Oelckers
parent 1719b70559
commit 9cc8dee5fe

View file

@ -3495,9 +3495,12 @@ default_case:
SA(spriteNum) = (sprite[dmgSrc].ang + 1024) & 2047; SA(spriteNum) = (sprite[dmgSrc].ang + 1024) & 2047;
sprite[spriteNum].xvel = -(sprite[dmgSrc].extra << 2); sprite[spriteNum].xvel = -(sprite[dmgSrc].extra << 2);
int16_t sectNum = SECT(spriteNum); int16_t sectNum = SECT(spriteNum);
pushmove((vec3_t *)&sprite[spriteNum], &sectNum, 128L, (4L << 8), (4L << 8), CLIPMASK0); if ((unsigned)sectNum < MAXSECTORS)
if (sectNum != SECT(spriteNum) && (unsigned)sectNum < MAXSECTORS) {
changespritesect(spriteNum, sectNum); pushmove((vec3_t *)&sprite[spriteNum], &sectNum, 128L, (4L << 8), (4L << 8), CLIPMASK0);
if (sectNum != SECT(spriteNum) && (unsigned)sectNum < MAXSECTORS)
changespritesect(spriteNum, sectNum);
}
} }
if (sprite[spriteNum].statnum == STAT_ZOMBIEACTOR) if (sprite[spriteNum].statnum == STAT_ZOMBIEACTOR)