From 1e31c1260a7cf2ef0a2dd61145afc0317d372a26 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 1 Mar 2022 17:35:16 +0100 Subject: [PATCH] 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. --- .../Applications/KeyboardSettings/KeyboardSettingsWidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp index 2a697b3e15..29ee5a9e4b 100644 --- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp +++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp @@ -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("remove_keymap_button");