]> granicus.if.org Git - nethack/commitdiff
usage of whichpm in new gender code required a null ptr guard
authornhmall <nhmall@nethack.org>
Tue, 29 Dec 2020 22:49:30 +0000 (17:49 -0500)
committernhmall <nhmall@nethack.org>
Tue, 29 Dec 2020 22:49:30 +0000 (17:49 -0500)
src/read.c

index a6fa79b1a633784fdc0be525526e84a4eef9ad40..fa790026fdcc91f9f56881cdc9e2f367f254a421 100644 (file)
@@ -2591,7 +2591,8 @@ struct _create_particular_data *d;
         if (d->genderconf == -1) {
             /* no confict exists between explicit gender term and
                the specified monster name */
-            if (d->fem != -1 && !is_male(whichpm) && !is_female(whichpm))
+            if (d->fem != -1
+                && (!whichpm || (!is_male(whichpm) && !is_female(whichpm))))
                 mmflags |= (d->fem == FEMALE) ? MM_FEMALE
                                : (d->fem == MALE) ? MM_MALE : 0;
         } else {