Code

screen_keydef: don't crash on Ctrl-Space
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Fri, 3 Feb 2012 18:44:33 +0000 (19:44 +0100)
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>
Fri, 3 Feb 2012 18:48:32 +0000 (19:48 +0100)
src/screen_keydef.c

index 4519008928ef0a4642c30064d0e6b1dff1f5f42b..32791b8c0e364a2eb32eab2006e2c7d098c8442f 100644 (file)
@@ -265,11 +265,16 @@ overwrite_key(int cmd_index, int key_index)
        key = screen_getch(buf);
        g_free(buf);
 
-       if (key==ERR) {
+       if (key == ERR) {
                screen_status_printf(_("Aborted"));
                return;
        }
 
+       if (key == '\0') {
+               screen_status_printf(_("Ctrl-Space can't be used"));
+               return;
+       }
+
        cmd = find_key_command(key, cmds);
        if (cmd != CMD_NONE) {
                screen_status_printf(_("Error: key %s is already used for %s"),