From 43028a4e382aa1cfac62e4f045575631b3879b8b Mon Sep 17 00:00:00 2001 From: kinther Date: Wed, 1 Oct 2025 05:50:35 -0700 Subject: [PATCH] Fix hedit segfault issue --- src/hedit.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hedit.c b/src/hedit.c index 4aebacf..4320bc3 100644 --- a/src/hedit.c +++ b/src/hedit.c @@ -84,12 +84,15 @@ ACMD(do_oasis_hedit) OLC_ZNUM(d) = search_help(OLC_STORAGE(d), LVL_IMPL); - if (help_table[OLC_ZNUM(d)].duplicate) { - for (i = 0; i < top_of_helpt; i++) - if (help_table[i].duplicate == 0 && help_table[i].entry == help_table[OLC_ZNUM(d)].entry) { + /* Only check duplicate chains if we found a real record */ + if (OLC_ZNUM(d) != NOWHERE && help_table[OLC_ZNUM(d)].duplicate) { + for (i = 0; i < top_of_helpt; i++) { + if (help_table[i].duplicate == 0 && + help_table[i].entry == help_table[OLC_ZNUM(d)].entry) { OLC_ZNUM(d) = i; break; } + } } if (OLC_ZNUM(d) == NOWHERE) {