Add null-check on repairable_damage()

Add null-check of dam before its first use.
This commit is contained in:
SHIRAKATA Kentaro
2022-02-09 00:17:16 +09:00
parent e10dff845f
commit b55954b2a1

View File

@@ -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;