mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
rootston: roots_keyboard null check
This commit is contained in:
parent
d6513cef5d
commit
1472dbda74
2 changed files with 9 additions and 0 deletions
|
@ -249,6 +249,10 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
|||
keyboard->input = input;
|
||||
|
||||
struct keyboard_config *config = calloc(1, sizeof(struct keyboard_config));
|
||||
if (config == NULL) {
|
||||
free(keyboard);
|
||||
return NULL;
|
||||
}
|
||||
keyboard_config_merge(config, config_get_keyboard(input->config, device));
|
||||
keyboard_config_merge(config, config_get_keyboard(input->config, NULL));
|
||||
|
||||
|
|
|
@ -306,6 +306,11 @@ void roots_seat_destroy(struct roots_seat *seat) {
|
|||
static void seat_add_keyboard(struct roots_seat *seat, struct wlr_input_device *device) {
|
||||
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
|
||||
struct roots_keyboard *keyboard = roots_keyboard_create(device, seat->input);
|
||||
if (keyboard == NULL) {
|
||||
wlr_log(L_ERROR, "could not allocate keyboard for seat");
|
||||
return;
|
||||
}
|
||||
|
||||
keyboard->seat = seat;
|
||||
|
||||
wl_list_insert(&seat->keyboards, &keyboard->link);
|
||||
|
|
Loading…
Reference in a new issue