From eb31744be1e7b963b157f6b442e463ba66a7b816 Mon Sep 17 00:00:00 2001 From: Erik Lunna Date: Sat, 23 Sep 2023 08:15:08 +0200 Subject: [PATCH] Fix: useup bug from being able to detect gems with scrolls of gold detection. --- src/read.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/read.c b/src/read.c index bdce3abbf..47ab75612 100644 --- a/src/read.c +++ b/src/read.c @@ -2238,16 +2238,18 @@ struct obj *sobj; /* sobj - scroll or fake spellbook for spell */ break; case SCR_GOLD_DETECTION: { boolean failure; + if (!sobj) + break; if (confused || scursed) { failure = trap_detect(sobj, TRUE) != 0; } else { failure = gold_detect(sobj) != 0; - if (sobj->blessed && (object_detect(sobj, GEM_CLASS) == 0)) + if (!failure && sobj && sobj->blessed + && (object_detect(sobj, GEM_CLASS) == 0)) failure = FALSE; } if (failure) { sobj = 0; /* failure: strange_feeling() -> useup() */ - useup(sobj); } break; }