From 158f18df0d8421785d8b949e03253dd479af22c7 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sat, 29 Mar 2025 15:43:40 -0700 Subject: [PATCH] Work around unwrap crash --- node-graph/gcore/src/vector/vector_data.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/node-graph/gcore/src/vector/vector_data.rs b/node-graph/gcore/src/vector/vector_data.rs index a141655f..320f8fbc 100644 --- a/node-graph/gcore/src/vector/vector_data.rs +++ b/node-graph/gcore/src/vector/vector_data.rs @@ -519,7 +519,10 @@ impl HandleId { /// Calculate the magnitude of the handle from the anchor. pub fn length(self, vector_data: &VectorData) -> f64 { - let anchor_position = self.to_manipulator_point().get_anchor_position(vector_data).unwrap(); + let Some(anchor_position) = self.to_manipulator_point().get_anchor_position(vector_data) else { + // TODO: This was previously an unwrap which was encountered, so this is a temporary way to avoid a crash + return 0.; + }; let handle_position = self.to_manipulator_point().get_position(vector_data); handle_position.map(|pos| (pos - anchor_position).length()).unwrap_or(f64::MAX) }