From 5bbca2fa8badb4f6eaa6112856ff119480a900ff Mon Sep 17 00:00:00 2001 From: NonStandardModel <33322918+NonStandardModel@users.noreply.github.com> Date: Thu, 3 Jun 2021 17:19:07 +0200 Subject: KeyboardMapper: Fix crash upon loading an invalid JSON file This fixes #7699. It would be nice to also show a GUI alert informing about the failure, but I will leave that for the future. --- Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Userland/Applications') diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index dba547022b..77322956b8 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -126,7 +126,10 @@ void KeyboardMapperWidget::create_frame() void KeyboardMapperWidget::load_from_file(String filename) { auto result = Keyboard::CharacterMapFile::load_from_file(filename); - VERIFY(result.has_value()); + if (!result.has_value()) { + dbgln("Failed to load character map from file {}", filename); + return; + } m_filename = filename; m_character_map = result.value(); -- cgit v1.2.3