mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 18:17:23 +00:00
Spreadsheet: Check for parse errors after parsing the source
There won't be any parse errors before we actually try to parse something. Fixes input like "=1+" crashing the spreadsheet instead of just causing an error in the cell.
This commit is contained in:
parent
fef165f1d2
commit
7b4fa860d2
Notes:
sideshowbarker
2024-07-18 21:08:34 +09:00
Author: https://github.com/alimpfard
Commit: 7b4fa860d2
Pull-request: https://github.com/SerenityOS/serenity/pull/5912
Issue: https://github.com/SerenityOS/serenity/issues/4822
Issue: https://github.com/SerenityOS/serenity/issues/5905
Issue: https://github.com/SerenityOS/serenity/issues/5909
Issue: https://github.com/SerenityOS/serenity/issues/5910
1 changed files with 1 additions and 1 deletions
|
@ -199,10 +199,10 @@ Sheet::ValueAndException Sheet::evaluate(const StringView& source, Cell* on_beha
|
|||
ScopeGuard clear_exception { [&] { interpreter().vm().clear_exception(); } };
|
||||
|
||||
auto parser = JS::Parser(JS::Lexer(source));
|
||||
auto program = parser.parse_program();
|
||||
if (parser.has_errors() || interpreter().exception())
|
||||
return { JS::js_undefined(), interpreter().exception() };
|
||||
|
||||
auto program = parser.parse_program();
|
||||
interpreter().run(global_object(), program);
|
||||
if (interpreter().exception()) {
|
||||
auto exc = interpreter().exception();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue