From b55954b2a11d15914fac2a6c9f8d409f921df177 Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Wed, 9 Feb 2022 00:17:16 +0900 Subject: [PATCH] Add null-check on repairable_damage() Add null-check of dam before its first use. --- src/shk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shk.c b/src/shk.c index d16529703..3175eb60e 100644 --- a/src/shk.c +++ b/src/shk.c @@ -3525,13 +3525,16 @@ shk_impaired(struct monst *shkp) static boolean repairable_damage(struct damage *dam, struct monst *shkp) { - xchar x = dam->place.x, y = dam->place.y; + xchar x, y; struct trap* ttmp; struct monst *mtmp; if (!dam || shk_impaired(shkp)) return FALSE; + x = dam->place.x; + y = dam->place.y; + /* too soon to fix it? */ if ((g.moves - dam->when) < REPAIR_DELAY) return FALSE;