1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:07:34 +00:00

KeyboardSettings: Fix adding empty keymaps

In the Keymap Settings dialog, a check was missing when the Keymap
selection dialog was cancelled.

Not checking the return value causes an empty string to be added to
the keymap list.
This commit is contained in:
Thomas 2022-03-01 17:35:16 +01:00 committed by Andreas Kling
parent 451fee8fd7
commit 1e31c1260a

View file

@ -163,7 +163,8 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
m_add_keymap_button->on_click = [&](auto) { m_add_keymap_button->on_click = [&](auto) {
auto keymap = KeymapSelectionDialog::select_keymap(window(), keymaps_list_model.keymaps()); auto keymap = KeymapSelectionDialog::select_keymap(window(), keymaps_list_model.keymaps());
keymaps_list_model.add_keymap(keymap); if (!keymap.is_empty())
keymaps_list_model.add_keymap(keymap);
}; };
m_remove_keymap_button = find_descendant_of_type_named<GUI::Button>("remove_keymap_button"); m_remove_keymap_button = find_descendant_of_type_named<GUI::Button>("remove_keymap_button");