From eed0831f286585d2ed7de643d1345bda1493bf4f Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Thu, 24 Jan 2002 18:21:24 +0000 Subject: [PATCH] Fix a crash-causing null pointer dereference. (Thanks to Yitzhak) --- src/hack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hack.c b/src/hack.c index e6a4cc880..a0d5ab25b 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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); -- 2.50.1