summaryrefslogtreecommitdiff
path: root/Userland/Utilities/keymap.cpp
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-01-30 22:41:29 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-01 09:54:32 +0100
commit0e3408d4d603ab3d1945818ed5875eaf5b4c6b4b (patch)
tree3307b52d0d48a1092c6205e53d3daf963b330d33 /Userland/Utilities/keymap.cpp
parentd9e7e13fb23f1d904c439ded253c2be14f82c86b (diff)
downloadserenity-0e3408d4d603ab3d1945818ed5875eaf5b4c6b4b.zip
LibKeyboard: Don't assert on failure
Diffstat (limited to 'Userland/Utilities/keymap.cpp')
-rw-r--r--Userland/Utilities/keymap.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Userland/Utilities/keymap.cpp b/Userland/Utilities/keymap.cpp
index f32d27f2c3..47c4b00623 100644
--- a/Userland/Utilities/keymap.cpp
+++ b/Userland/Utilities/keymap.cpp
@@ -65,10 +65,17 @@ int main(int argc, char** argv)
return 0;
}
- Keyboard::CharacterMap character_map(path);
- int rc = character_map.set_system_map();
- if (rc != 0)
+ auto character_map = Keyboard::CharacterMap::load_from_file(path);
+ if (!character_map.has_value()) {
+ warnln("Cannot read keymap {}", path);
+ warnln("Hint: Must be either a keymap name (e.g. 'en') or a full path.");
+ return 1;
+ }
+
+ int rc = character_map.value().set_system_map();
+ if (rc != 0) {
perror("setkeymap");
+ }
return rc;
}