diff --git a/include/extern.h b/include/extern.h index a00857522..e339ae7f3 100644 --- a/include/extern.h +++ b/include/extern.h @@ -801,7 +801,7 @@ extern const char *surface(coordxy, coordxy); extern const char *ceiling(coordxy, coordxy); extern boolean In_quest(d_level *) NONNULLARG1; extern boolean In_mines(d_level *) NONNULLARG1; -extern branch *dungeon_branch(const char *) NONNULLARG1; +extern branch *dungeon_branch(const char *) NONNULL NONNULLARG1; extern boolean at_dgn_entrance(const char *) NONNULLARG1; extern boolean In_hell(d_level *) NONNULLARG1; extern boolean In_V_tower(d_level *) NONNULLARG1; diff --git a/src/mklev.c b/src/mklev.c index 9a02c01bc..e4f6cd62e 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -4,6 +4,7 @@ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" +#include /* for UNIX, Rand #def'd to (long)lrand48() or (long)random() */ /* croom->lx etc are schar (width <= int), so % arith ensures that */ @@ -2296,6 +2297,9 @@ mk_knox_portal(coordxy x, coordxy y) schar u_depth; br = dungeon_branch("Fort Ludios"); + /* dungeon_branch() panics (so never returns) if result would be Null */ + assert(br != NULL); + if (on_level(&knox_level, &br->end1)) { source = &br->end2; } else {