Spreadsheet: Skip over "invalid" saved cell values
These can be generated by saving something that's not serialisable (e.g. functions), skip over them and let the load logic reevaluate them when needed.
This commit is contained in:
parent
b0b8d14a2c
commit
0d302516d5
Notes:
sideshowbarker
2024-07-17 17:03:29 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/0d302516d5 Pull-request: https://github.com/SerenityOS/serenity/pull/13153 Reviewed-by: https://github.com/linusg ✅
1 changed files with 4 additions and 1 deletions
|
@ -416,7 +416,10 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
|
|||
case Cell::Formula: {
|
||||
auto& interpreter = sheet->interpreter();
|
||||
auto value_or_error = JS::call(interpreter.global_object(), parse_function, json, JS::js_string(interpreter.heap(), obj.get("value").as_string()));
|
||||
VERIFY(!value_or_error.is_error());
|
||||
if (value_or_error.is_error()) {
|
||||
warnln("Failed to load previous value for cell {}, leaving as undefined", position.to_cell_identifier(sheet));
|
||||
value_or_error = JS::js_undefined();
|
||||
}
|
||||
cell = make<Cell>(obj.get("source").to_string(), value_or_error.release_value(), position, *sheet);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue