mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05: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
Notes:
sideshowbarker
2024-07-19 05:19:48 +09:00
Author: https://github.com/sppmacd 🔰 Commit: https://github.com/SerenityOS/serenity/commit/48cd26f12d4 Pull-request: https://github.com/SerenityOS/serenity/pull/2656 Reviewed-by: https://github.com/awesomekling
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
Reference in a new issue