From: SHIRAKATA Kentaro Date: Tue, 8 Feb 2022 15:17:16 +0000 (+0900) Subject: Add null-check on repairable_damage() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b55954b2a11d15914fac2a6c9f8d409f921df177;p=nethack Add null-check on repairable_damage() Add null-check of dam before its first use. --- 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;