src/uhitm: Avoid touch_petrifies with invalid corpsenm

Before checking with touch_petrifies, check that corpsenm
is valid (>= LOW_PM)
This commit is contained in:
Mika Kuoppala
2024-01-06 12:06:55 -08:00
committed by PatR
parent c4d3ca00ce
commit 83fba62152
+2 -1
View File
@@ -1156,7 +1156,8 @@ hmon_hitmon_misc_obj(
change_luck(-5); change_luck(-5);
} }
if (touch_petrifies(&mons[obj->corpsenm])) { if (obj->corpsenm >= LOW_PM
&& touch_petrifies(&mons[obj->corpsenm])) {
/*learn_egg_type(obj->corpsenm);*/ /*learn_egg_type(obj->corpsenm);*/
pline("Splat! You hit %s with %s %s egg%s!", pline("Splat! You hit %s with %s %s egg%s!",
mon_nam(mon), mon_nam(mon),