From b82f5fa28fdec13b60e9bc71d15ab3bcc893692d Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Wed, 9 Feb 2022 05:50:49 +0900 Subject: [PATCH] remove redundant null-check on untrap_prob() `ttmp` should not be NULL here, otherwise this function will crash at earlier code. --- src/trap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/trap.c b/src/trap.c index deeab493f..09af868f1 100644 --- a/src/trap.c +++ b/src/trap.c @@ -4468,6 +4468,7 @@ untrap_prob(struct trap *ttmp) int chance = 3; /* Only spiders know how to deal with webs reliably */ + /* Assume ttmp is not NULL */ if (ttmp->ttyp == WEB && !webmaker(g.youmonst.data)) chance = 7; /* 3.7: used to be 30 */ if (Confusion || Hallucination) @@ -4479,7 +4480,7 @@ untrap_prob(struct trap *ttmp) if (Fumbling) chance *= 2; /* Your own traps are better known than others. */ - if (ttmp && ttmp->madeby_u) + if (ttmp->madeby_u) chance--; if (Role_if(PM_ROGUE)) { if (rn2(2 * MAXULEV) < u.ulevel) -- 2.50.1