Skip to content

Commit 9d1b386

Browse files
committed
Fix: follow up to crash when examining discoveries with '`' in certain cases.
NetHack 3.7 also had this bug, and it seems it's been present as far back as version 3.2.0 - the NetHack devteam released the proper fix for this earlier today (git commit 3a9e53a).
1 parent 72d226d commit 9d1b386

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

doc/evilhack-changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3343,4 +3343,5 @@ The following changes to date are:
33433343
- Fix: crash when examining discoveries with '`' in certain cases
33443344
- Fix: allow spear traps to be disarmed
33453345
- Fix: heap-use-after-free (bones)
3346+
- Fix: follow up to crash when examining discoveries with '`' in certain cases
33463347

src/invent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4102,7 +4102,7 @@ boolean unpaid, showsym;
41024102
else if ((pos = index(oth_symbols, let)) != 0)
41034103
class_name = oth_names[pos - oth_symbols];
41044104
else
4105-
class_name = names[0];
4105+
class_name = names[ILLOBJ_CLASS];
41064106

41074107
len = strlen(class_name) + (unpaid ? sizeof "unpaid_" : sizeof "")
41084108
+ (oclass ? (strlen(ocsymfmt) + invbuf_sympadding) : 0);

win/curses/cursdial.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ curses_character_input_dialog(const char *prompt, const char *choices,
318318
}
319319
break;
320320
} else if ((answer == '\n') || (answer == '\r') || (answer == ' ')) {
321-
if (choices != NULL) {
321+
if ((choices != NULL)
322+
&& ((def != '\0') || !strchr(choices, answer))) {
322323
answer = def;
323324
}
324325
break;

0 commit comments

Comments
 (0)