]> granicus.if.org Git - nethack/commitdiff
Fix a crash-causing null pointer dereference.
authornethack.allison <nethack.allison>
Thu, 24 Jan 2002 18:21:24 +0000 (18:21 +0000)
committernethack.allison <nethack.allison>
Thu, 24 Jan 2002 18:21:24 +0000 (18:21 +0000)
(Thanks to Yitzhak)

src/hack.c

index e6a4cc8807e1a57c6e3fdfbd45dee29194dd0289..a0d5ab25b96767d3739e6dfb1c6fe598f98cb299 100644 (file)
@@ -545,7 +545,8 @@ boolean test_only;
        } else if (tunnels(youmonst.data) && !needspick(youmonst.data)) {
            /* Eat the rock. */
            if (!test_only && still_chewing(x,y)) return FALSE;
-       } else if (flags.autodig && !flags.run && !flags.nopick && (uwep->otyp == PICK_AXE || uwep->otyp == DWARVISH_MATTOCK)) {
+       } else if (flags.autodig && !flags.run && !flags.nopick &&
+                  (uwep && (uwep->otyp == PICK_AXE || uwep->otyp == DWARVISH_MATTOCK))) {
        /* MRKR: Automatic digging when wielding the appropriate tool */
            if (!test_only) {
                use_pick_axe2(uwep);