From bfe19193b95e9d1be0694bbc6a96e20a9aefdc09 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 11 Nov 2019 03:20:33 +0100 Subject: Fix integer overflow in `flex::resolve` --- native/src/layout/flex.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'native/src/layout') diff --git a/native/src/layout/flex.rs b/native/src/layout/flex.rs index 98cc344e..ec3e2d00 100644 --- a/native/src/layout/flex.rs +++ b/native/src/layout/flex.rs @@ -63,7 +63,8 @@ where { let limits = limits.pad(padding); - let mut total_non_fill = spacing as f32 * (children.len() - 1) as f32; + let mut total_non_fill = + spacing as f32 * (children.len() as i32 - 1).max(0) as f32; let mut fill_sum = 0; let mut nodes: Vec = Vec::with_capacity(children.len()); -- cgit