error out instead of accepting invalid key bindings (Thanks SardemFF7)
This commit is contained in:
parent
94d95f2b8c
commit
80492c8304
@ -186,6 +186,10 @@ CFGFUN(binding, const char *bindtype, const char *modifiers, const char *key, co
|
|||||||
} else {
|
} else {
|
||||||
// TODO: strtol with proper error handling
|
// TODO: strtol with proper error handling
|
||||||
new_binding->keycode = atoi(key);
|
new_binding->keycode = atoi(key);
|
||||||
|
if (new_binding->keycode == 0) {
|
||||||
|
ELOG("Could not parse \"%s\" as a keycode, ignoring this binding.\n", key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
new_binding->mods = modifiers_from_str(modifiers);
|
new_binding->mods = modifiers_from_str(modifiers);
|
||||||
new_binding->command = sstrdup(command);
|
new_binding->command = sstrdup(command);
|
||||||
@ -208,6 +212,10 @@ CFGFUN(mode_binding, const char *bindtype, const char *modifiers, const char *ke
|
|||||||
} else {
|
} else {
|
||||||
// TODO: strtol with proper error handling
|
// TODO: strtol with proper error handling
|
||||||
new_binding->keycode = atoi(key);
|
new_binding->keycode = atoi(key);
|
||||||
|
if (new_binding->keycode == 0) {
|
||||||
|
ELOG("Could not parse \"%s\" as a keycode, ignoring this binding.\n", key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
new_binding->mods = modifiers_from_str(modifiers);
|
new_binding->mods = modifiers_from_str(modifiers);
|
||||||
new_binding->command = sstrdup(command);
|
new_binding->command = sstrdup(command);
|
||||||
|
Loading…
Reference in New Issue
Block a user