static analyzer bit for shknam.c

src/shknam.c(530): warning: Dereferencing NULL pointer 'shname'.
This commit is contained in:
nhmall
2023-12-27 11:05:38 -05:00
parent 6e654cb9a5
commit aedbebad18

View File

@@ -536,6 +536,7 @@ nameshk(struct monst* shk, const char* const* nlp)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp) || (mtmp == shk) || !mtmp->isshk)
continue;
assert(has_eshk(mtmp));
if (strcmp(ESHK(mtmp)->shknam, shname))
continue;
name_wanted = names_avail; /* try a random name */