Skip to content

Commit 158f18d

Browse files
committed
Work around unwrap crash
1 parent a1ce796 commit 158f18d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

node-graph/gcore/src/vector/vector_data.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,10 @@ impl HandleId {
519519

520520
/// Calculate the magnitude of the handle from the anchor.
521521
pub fn length(self, vector_data: &VectorData) -> f64 {
522-
let anchor_position = self.to_manipulator_point().get_anchor_position(vector_data).unwrap();
522+
let Some(anchor_position) = self.to_manipulator_point().get_anchor_position(vector_data) else {
523+
// TODO: This was previously an unwrap which was encountered, so this is a temporary way to avoid a crash
524+
return 0.;
525+
};
523526
let handle_position = self.to_manipulator_point().get_position(vector_data);
524527
handle_position.map(|pos| (pos - anchor_position).length()).unwrap_or(f64::MAX)
525528
}

0 commit comments

Comments
 (0)