From 1e4bbc6eab4d5ad64aa6c06809ea111ff46b22de Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 23 Jul 2022 22:10:08 +0200 Subject: [PATCH] Fix infinite loop in H/VJoins without expanding sections --- src/ui/widgets/join.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ui/widgets/join.rs b/src/ui/widgets/join.rs index 9b6c05c..89c8945 100644 --- a/src/ui/widgets/join.rs +++ b/src/ui/widgets/join.rs @@ -23,6 +23,11 @@ impl Segment { } fn expand(amounts: &mut [(u16, bool)], total: u16) { + let any_expanding = amounts.iter().any(|(_, expanding)| *expanding); + if !any_expanding { + return; + } + // Weirdly, rustc needs this type annotation while rust-analyzer manages to // derive the correct type in an inlay hint. let actual: u16 = amounts.iter().map(|(a, _)| *a).sum();