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
Notes: sideshowbarker 2024-07-19 17:08:02 +09:00

View File

@@ -163,7 +163,8 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
m_add_keymap_button->on_click = [&](auto) {
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");