mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-18 23:12:02 +00:00
LibWeb/Editing: Handle no active range in queryCommandState
Fixes a crash when this is invoked if no range is active for the document.
This commit is contained in:
parent
7c7fec5e00
commit
556acd82ee
Notes:
github-actions[bot]
2025-05-26 21:37:43 +00:00
Author: https://github.com/shannonbooth
Commit: 556acd82ee
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4875
Reviewed-by: https://github.com/gmta ✅
3 changed files with 5 additions and 1 deletions
|
@ -329,6 +329,9 @@ WebIDL::ExceptionOr<bool> Document::query_command_state(FlyString const& command
|
|||
if (inline_values.is_empty())
|
||||
return false;
|
||||
auto range = Editing::active_range(*this);
|
||||
if (!range)
|
||||
return false;
|
||||
|
||||
Vector<GC::Ref<Node>> formattable_nodes;
|
||||
Editing::for_each_node_effectively_contained_in_range(range, [&](GC::Ref<Node> descendant) {
|
||||
if (Editing::is_formattable_node(descendant))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue