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

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.
This commit is contained in:
NonStandardModel 2021-06-03 17:19:07 +02:00 committed by GitHub
parent 47c1a31f89
commit 5bbca2fa8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();