mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb: Fix division by zero in distribute_any_remaining_free_space
This change fixes division by zero in case flex container has "justify-content: space-between" and only single item.
This commit is contained in:
parent
6088374ad2
commit
849cf894d8
Notes:
sideshowbarker
2024-07-17 06:28:38 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 849cf894d8
Pull-request: https://github.com/SerenityOS/serenity/pull/20190
3 changed files with 17 additions and 1 deletions
|
@ -1331,7 +1331,8 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
|
|||
} else {
|
||||
initial_offset = 0;
|
||||
}
|
||||
space_between_items = flex_line.remaining_free_space / (number_of_items - 1);
|
||||
if (number_of_items > 1)
|
||||
space_between_items = flex_line.remaining_free_space / (number_of_items - 1);
|
||||
break;
|
||||
case CSS::JustifyContent::SpaceAround:
|
||||
space_between_items = flex_line.remaining_free_space / number_of_items;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue