From a1e235f028faa146cd8df95d04e651b7aabf0642 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Oct 2022 16:58:09 +0200 Subject: [PATCH] Fix validation check in `Cycle` It didn't do the check, if the cycle had only one edge. --- crates/fj-kernel/src/objects/cycle.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/fj-kernel/src/objects/cycle.rs b/crates/fj-kernel/src/objects/cycle.rs index cfddc5fa9..b773303e8 100644 --- a/crates/fj-kernel/src/objects/cycle.rs +++ b/crates/fj-kernel/src/objects/cycle.rs @@ -53,19 +53,19 @@ impl Cycle { "Edges in cycle do not connect" ); } + } - // Verify that the edges form a cycle - if let Some(first) = half_edges.first() { - if let Some(last) = half_edges.last() { - let [first, _] = first.vertices(); - let [_, last] = last.vertices(); + // Verify that the edges form a cycle + if let Some(first) = half_edges.first() { + if let Some(last) = half_edges.last() { + let [first, _] = first.vertices(); + let [_, last] = last.vertices(); - assert_eq!( - first.surface_form(), - last.surface_form(), - "Edges do not form a cycle" - ); - } + assert_eq!( + first.surface_form(), + last.surface_form(), + "Edges do not form a cycle" + ); } }