opt: avoid crash when Incorrect Settings for keyboard layout

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

View File

@@ -4546,6 +4546,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");