mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-04 01:05:58 +03:00
Shell: Don't blindly dereference the result of Parser::parse()
It _may_ return nullptr if there's nothing to return. Fixes #5691.
This commit is contained in:
parent
26c4cae77c
commit
fb68aa1480
Notes:
sideshowbarker
2024-07-18 21:37:37 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/fb68aa1480d Pull-request: https://github.com/SerenityOS/serenity/pull/5693 Issue: https://github.com/SerenityOS/serenity/issues/5691
@ -1582,7 +1582,11 @@ bool Shell::has_history_event(StringView source)
|
||||
bool has_history_event { false };
|
||||
} visitor;
|
||||
|
||||
Parser { source, true }.parse()->visit(visitor);
|
||||
auto ast = Parser { source, true }.parse();
|
||||
if (!ast)
|
||||
return false;
|
||||
|
||||
ast->visit(visitor);
|
||||
return visitor.has_history_event;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user