dothrow: Check for LOW_PM before accessing mon array
on toss_up() when checking for touch_petrifies, add a check for corpsenm >= LOW_PM as EGG can be without corpse reference. This prevents: dothrow.c:1266:29: runtime error: index -1 out of bounds for type 'permonst [384]'
This commit is contained in:
@@ -1263,6 +1263,7 @@ toss_up(struct obj *obj, boolean hitsroof)
|
||||
const char *action;
|
||||
int otyp = obj->otyp;
|
||||
boolean petrifier = ((otyp == EGG || otyp == CORPSE)
|
||||
&& obj->corpsenm >= LOW_PM
|
||||
&& touch_petrifies(&mons[obj->corpsenm]));
|
||||
/* note: obj->quan == 1 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user