From: SHIRAKATA Kentaro Date: Mon, 21 Mar 2022 11:31:41 +0000 (+0900) Subject: move null-check on savelev() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=291d872f622dd926e56109544f4681896fa146a3;p=nethack move null-check on savelev() Move null-check of ttmp before its first use. --- diff --git a/src/trap.c b/src/trap.c index 406890a9a..012ab4b71 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3025,11 +3025,14 @@ find_random_launch_coord(struct trap *ttmp, coord *cc) int mindist = 4; int trycount = 0; xchar dx, dy; - xchar x = ttmp->tx, y = ttmp->ty; + xchar x, y; if (!ttmp || !cc) return FALSE; + x = ttmp->tx; + y = ttmp->ty; + bcc.x = ttmp->tx + g.launchplace.x; bcc.y = ttmp->ty + g.launchplace.y; if (isok(bcc.x, bcc.y) && linedup(ttmp->tx, ttmp->ty, bcc.x, bcc.y, 1)) {