Fix segfault when binding keys in-game

This commit is contained in:
Pasi Kallinen
2026-04-06 11:50:22 +03:00
parent 0a3b8a7b72
commit 190cbfa2b7
+3 -3
View File
@@ -2297,7 +2297,6 @@ handler_rebind_keys_add(boolean keyfirst)
char buf2[QBUFSZ]; char buf2[QBUFSZ];
uchar key = '\0'; uchar key = '\0';
int clr = NO_COLOR; int clr = NO_COLOR;
struct Cmd_bind *bind;
if (keyfirst) { if (keyfirst) {
pline("Bind which key? "); pline("Bind which key? ");
@@ -2312,8 +2311,9 @@ handler_rebind_keys_add(boolean keyfirst)
any = cg.zeroany; any = cg.zeroany;
if (key) { if (key) {
bind = cmdbind_get(key); struct Cmd_bind *bind = cmdbind_get(key);
if (bind) {
if (bind && bind->cmd) {
Sprintf(buf, "Key '%s' is currently bound to \"%s\".", Sprintf(buf, "Key '%s' is currently bound to \"%s\".",
key2txt(key, buf2), bind->cmd->ef_txt); key2txt(key, buf2), bind->cmd->ef_txt);
} else { } else {