summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-12-05 15:51:01 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-12-05 15:57:29 +0100
commitdb8886a34cfc026b7a95ab0256317e5ec7ce728a (patch)
tree4deced811b31a4ef9c1f4223a233140b6ee7ae4d
parenta9cbf27536b2f9b8c16055b35b851b9f2caf4f4a (diff)
downloadcalcurse-db8886a34cfc026b7a95ab0256317e5ec7ce728a.tar.gz
calcurse-db8886a34cfc026b7a95ab0256317e5ec7ce728a.zip
keys_save_bindings(): Skip unset key bindings
Saving unset key bindings currently results in a segmentation fault or invalid key specifiers being stored. Skip these entries to avoid this. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--src/keys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/keys.c b/src/keys.c
index a908bd0..0d54701 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -547,11 +547,15 @@ void keys_popup_info(enum key key)
void keys_save_bindings(FILE * fd)
{
int i;
+ char *action;
EXIT_IF(fd == NULL, _("FATAL ERROR: null file pointer."));
dump_intro(fd);
- for (i = 0; i < NBKEYS; i++)
- fprintf(fd, "%s %s\n", keydef[i].label, keys_action_allkeys(i));
+ for (i = 0; i < NBKEYS; i++) {
+ action = keys_action_allkeys(i);
+ if (action)
+ fprintf(fd, "%s %s\n", keydef[i].label, action);
+ }
}
int keys_check_missing_bindings(void)