From 291d872f622dd926e56109544f4681896fa146a3 Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Mon, 21 Mar 2022 20:31:41 +0900 Subject: [PATCH] move null-check on savelev() Move null-check of ttmp before its first use. --- src/trap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)) {