mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:35:07 +00:00
LibKeyboard: Don't crash when file is empty
Just return empty map, like when file error occurs.
This commit is contained in:
parent
53573f6fb1
commit
48cd26f12d
1 changed files with 2 additions and 1 deletions
|
@ -50,7 +50,8 @@ Optional<CharacterMapData> CharacterMapFile::load_from_file(const String& file_n
|
|||
|
||||
auto file_contents = file->read_all();
|
||||
auto json_result = JsonValue::from_string(file_contents);
|
||||
ASSERT(json_result.has_value());
|
||||
if (!json_result.has_value())
|
||||
return {};
|
||||
auto json = json_result.value().as_object();
|
||||
|
||||
Vector<u32> map = read_map(json, "map");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue