mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-24 11:21:34 +00:00
LibWeb: Don't assume calc() simplification worked on invalid tree
Fixes #4469
This commit is contained in:
parent
4e298db4f5
commit
d8ea16d94e
Notes:
github-actions[bot]
2025-04-25 14:56:08 +00:00
Author: https://github.com/awesomekling
Commit: d8ea16d94e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4472
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/tcl3
3 changed files with 123 additions and 2 deletions
|
@ -2926,8 +2926,9 @@ NonnullRefPtr<CalculationNode const> simplify_a_calculation_tree(CalculationNode
|
|||
// running root’s operation using its children, expressed in the result’s canonical unit.
|
||||
if (root->is_math_function_node()) {
|
||||
if (auto maybe_simplified = root->run_operation_if_possible(context, resolution_context); maybe_simplified.has_value()) {
|
||||
// NOTE: If this returns nullptr, that's a logic error in the code, so it's fine to assert that it's nonnull.
|
||||
return make_calculation_node(maybe_simplified.release_value(), context).release_nonnull();
|
||||
if (auto node = make_calculation_node(maybe_simplified.release_value(), context))
|
||||
return node.release_nonnull();
|
||||
return root;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue