From: nethack.rankin Date: Thu, 8 Jun 2006 05:05:33 +0000 (+0000) Subject: charging scroll fix (trunk only) X-Git-Tag: MOVE2GIT~990 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d439b123d27fb0f1854b105cd310f9ebbef57d26;p=nethack charging scroll fix (trunk only) A while back some code ended up in the wrong order, resulting in null pointer dereference when reading a not-yet-discovered scroll of charging. --- diff --git a/src/read.c b/src/read.c index 4cd0af8fb..fe498b480 100644 --- a/src/read.c +++ b/src/read.c @@ -1179,15 +1179,15 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ break; } /* known = TRUE; -- handled inline here */ + if (!already_known) { + pline("This is a charging scroll."); + learnscroll(sobj); + } /* use it up now to prevent it from showing in the getobj picklist because the "disappears" message was already delivered */ useup(sobj); sobj = 0; /* it's gone */ - if (!already_known) { - pline("This is a charging scroll."); - learnscroll(sobj); - } otmp = getobj(all_count, "charge"); if (otmp) recharge(otmp, scursed ? -1 : sblessed ? 1 : 0); break;