opt: avoid crash when Incorrect Settings for keyboard layout

This commit is contained in:
DreamMaoMao 2025-11-01 14:29:53 +08:00
parent e658274b71
commit 3ebb9a1508
2 changed files with 28 additions and 6 deletions

View file

@ -4484,6 +4484,9 @@ bool check_keyboard_rules_validate(struct xkb_rule_names *rules) {
return false;
}
if (!rules->layout || strlen(rules->layout) == 0)
return false;
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (!context) {
wlr_log(WLR_ERROR, "Failed to create XKB context for validation");