mirror of
https://github.com/danbulant/cushy
synced 2026-07-08 04:30:34 +00:00
Fixed integer overflow in Grid
When no space is available for the first gutter when fractional widths are being used, there was a non-saturating subtraction that could underflow.
This commit is contained in:
parent
a79d2f7d58
commit
c117b1527e
1 changed files with 1 additions and 1 deletions
|
|
@ -457,7 +457,7 @@ impl GridLayout {
|
||||||
// Measure the weighted children within the remaining space
|
// Measure the weighted children within the remaining space
|
||||||
if self.total_weights > 0 {
|
if self.total_weights > 0 {
|
||||||
if requires_gutter {
|
if requires_gutter {
|
||||||
remaining -= gutter;
|
remaining = remaining.saturating_sub(gutter);
|
||||||
}
|
}
|
||||||
let space_per_weight = (remaining / self.total_weights).floor();
|
let space_per_weight = (remaining / self.total_weights).floor();
|
||||||
remaining = remaining.saturating_sub(space_per_weight * self.total_weights);
|
remaining = remaining.saturating_sub(space_per_weight * self.total_weights);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue