summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet/Spreadsheet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications/Spreadsheet/Spreadsheet.cpp')
-rw-r--r--Userland/Applications/Spreadsheet/Spreadsheet.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
index 47c73b73d2..2d8aa751c5 100644
--- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp
+++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
@@ -399,8 +399,9 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
break;
case Cell::Formula: {
auto& interpreter = sheet->interpreter();
- auto value = interpreter.vm().call(parse_function, json, JS::js_string(interpreter.heap(), obj.get("value").as_string()));
- cell = make<Cell>(obj.get("source").to_string(), move(value), position, *sheet);
+ auto value_or_error = interpreter.vm().call(parse_function, json, JS::js_string(interpreter.heap(), obj.get("value").as_string()));
+ VERIFY(!value_or_error.is_error());
+ cell = make<Cell>(obj.get("source").to_string(), value_or_error.release_value(), position, *sheet);
break;
}
}
@@ -526,8 +527,9 @@ JsonObject Sheet::to_json() const
if (it.value->kind() == Cell::Formula) {
data.set("source", it.value->data());
auto json = interpreter().global_object().get("JSON");
- auto stringified = interpreter().vm().call(json.as_object().get("stringify").as_function(), json, it.value->evaluated_data());
- data.set("value", stringified.to_string_without_side_effects());
+ auto stringified_or_error = interpreter().vm().call(json.as_object().get("stringify").as_function(), json, it.value->evaluated_data());
+ VERIFY(!stringified_or_error.is_error());
+ data.set("value", stringified_or_error.release_value().to_string_without_side_effects());
} else {
data.set("value", it.value->data());
}