From a62ded6d28895e5b58d22c0da1d563e11411913c Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 6 Feb 2024 14:33:16 -0500 Subject: [PATCH] ini_inv_mkobj_filter() bit The try count of 1000 is never going to be reached. The obj result, if it were ever to be reached, would have been unfiltered and potentially incorrect. There is no harm in having the result, in that theoretical edge case, not be one of the obj values that was intended to be filtered out. No practical change results from this, and pancake was used because it is innocuous. --- src/u_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/u_init.c b/src/u_init.c index 19acf7588..d55e0a5be 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -1074,10 +1074,13 @@ ini_inv_mkobj_filter(int oclass, boolean got_level1_spellbook) || restricted_spell_discipline(otyp))) || otyp == SPE_NOVEL) { dealloc_obj(obj); + if (++trycnt > 1000) { + /* not expected to be reached */ + obj = mksobj(PANCAKE, TRUE, FALSE); + break; + } obj = mkobj(oclass, FALSE); otyp = obj->otyp; - if (++trycnt > 1000) - break; } return obj; }