move null-check on savelev()

Move null-check of ttmp before its first use.
This commit is contained in:
SHIRAKATA Kentaro
2022-03-21 20:31:41 +09:00
parent 27ea4b7e52
commit 291d872f62

View File

@@ -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)) {