Skip to content

Commit a5ff4bd

Browse files
committed
Fix: Draugr trying to read a spellbook and the spellbook is destroyed while reading it.
1 parent e246459 commit a5ff4bd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

doc/evilhack-changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -3447,4 +3447,6 @@ The following changes to date are:
34473447
- Draugr can revive
34483448
- Fix: if burning hands or shocking grasp is active, don't activate
34493449
whilst using thievery skill
3450+
- Fix: Draugr trying to read a spellbook and the spellbook is
3451+
destroyed while reading it
34503452

src/spell.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,18 @@ learn(VOID_ARGS)
346346
boolean costly = TRUE;
347347
struct obj *book = context.spbook.book;
348348

349+
if (!book) {
350+
context.spbook.delay = 0;
351+
context.spbook.o_id = 0;
352+
return 0;
353+
}
354+
349355
/* JDS: lenses give 50% faster reading; 33% smaller read time */
350356
if (context.spbook.delay && ublindf && ublindf->otyp == LENSES && rn2(2))
351357
context.spbook.delay++;
352-
if (Confusion || (Race_if(PM_DRAUGR) && book->otyp != SPE_BOOK_OF_THE_DEAD)) { /* became confused while learning */
358+
if (Confusion
359+
|| (Race_if(PM_DRAUGR) && book
360+
&& book->otyp != SPE_BOOK_OF_THE_DEAD)) { /* became confused while learning */
353361
(void) confused_book(book);
354362
context.spbook.book = 0; /* no longer studying */
355363
context.spbook.o_id = 0;

0 commit comments

Comments
 (0)