From 83fba62152fb3715e89a6ab7ed8f013b76550fbe Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Wed, 13 Dec 2023 19:21:00 +0200 Subject: [PATCH] src/uhitm: Avoid touch_petrifies with invalid corpsenm Before checking with touch_petrifies, check that corpsenm is valid (>= LOW_PM) --- src/uhitm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uhitm.c b/src/uhitm.c index 6ab1fa8f0..886e62b44 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1156,7 +1156,8 @@ hmon_hitmon_misc_obj( change_luck(-5); } - if (touch_petrifies(&mons[obj->corpsenm])) { + if (obj->corpsenm >= LOW_PM + && touch_petrifies(&mons[obj->corpsenm])) { /*learn_egg_type(obj->corpsenm);*/ pline("Splat! You hit %s with %s %s egg%s!", mon_nam(mon),