diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-10-17 23:20:05 +0300 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-10-18 08:01:38 +0300 |
commit | 20d990563cf858d51d4c6bf93a7c37317c5ecd12 (patch) | |
tree | 4833bfedf796eec4a2b6da5bc2ac546a0ab6177f /Userland/Applications/Spreadsheet | |
parent | a36ee213b99113b4edb2f6f1578ab21582a0adfa (diff) | |
download | serenity-20d990563cf858d51d4c6bf93a7c37317c5ecd12.zip |
LibJS: Convert to_number() to ThrowCompletionOr
Diffstat (limited to 'Userland/Applications/Spreadsheet')
-rw-r--r-- | Userland/Applications/Spreadsheet/CellType/Numeric.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/Spreadsheet/JSIntegration.cpp | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp index 4b526786d0..7b8f098a2a 100644 --- a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp @@ -50,7 +50,7 @@ JS::Value NumericCell::js_value(Cell& cell, const CellTypeMetadata&) const cell.set_exception(exc); } } }; - return cell.js_data().to_number(cell.sheet().global_object()); + return TRY_OR_DISCARD(cell.js_data().to_number(cell.sheet().global_object())); } } diff --git a/Userland/Applications/Spreadsheet/JSIntegration.cpp b/Userland/Applications/Spreadsheet/JSIntegration.cpp index 071cd6c935..578cb9b8b3 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.cpp +++ b/Userland/Applications/Spreadsheet/JSIntegration.cpp @@ -352,9 +352,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_arithmetic) auto& column_name_str = column_name.as_string().string(); - auto offset = vm.argument(1).to_number(global_object); - if (!offset.is_number()) - return {}; + auto offset = TRY_OR_DISCARD(vm.argument(1).to_number(global_object)); auto offset_number = offset.as_i32(); |