Skip to content

Commit 0040220

Browse files
Fix: crash when examining discoveries with '`' in certain cases
The curses version of yn_function could return whitespace characters if the default was '\0'. This leads to a crash if you use the '`' option with curses enabled and a traditional/combination menu style (see doclassdisco() in o_init.c). Allow '\0' to be returned as a default. The tty version allows this, so it should not lead to unexpected input for other yn_function calls (I tested several to be sure).
1 parent b85ad40 commit 0040220

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/evilhack-changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -3340,3 +3340,4 @@ The following changes to date are:
33403340
- Fix: fixedness knowledge preventing merging of supermaterials
33413341
- Fix: a couple cases of bracers preventing wielding bimanual weapons
33423342
- Restore auto-suppression of some dangerous attacks
3343+
- Fix: crash when examining discoveries with '`' in certain cases

win/curses/cursdial.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ 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) && (def != '\0')) {
321+
if (choices != NULL) {
322322
answer = def;
323323
}
324324
break;

0 commit comments

Comments
 (0)