]> granicus.if.org Git - nethack/commitdiff
fix B07001 - crystal ball bug
authornethack.rankin <nethack.rankin>
Thu, 14 Aug 2003 02:25:36 +0000 (02:25 +0000)
committernethack.rankin <nethack.rankin>
Thu, 14 Aug 2003 02:25:36 +0000 (02:25 +0000)
     Applying a cursed crystal ball has a chance of detroying it; the
code to use up a charge wasn't taking that into account.

src/detect.c

index f4211cd5580a7f5ac7dbbe44dcfb95960a392966..693d4d64d044cfbf6ed4b53403914dc121a9bd82 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)detect.c   3.4     2003/05/25      */
+/*     SCCS Id: @(#)detect.c   3.4     2003/08/13      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -797,10 +797,11 @@ struct obj *obj;
            break;
        case 5 : pline("%s!", Tobjnam(obj, "explode"));
            useup(obj);
+           obj = 0;    /* it's gone */
            losehp(rnd(30), "exploding crystal ball", KILLED_BY_AN);
            break;
        }
-       consume_obj_charge(obj, TRUE);
+       if (obj) consume_obj_charge(obj, TRUE);
        return;
     }