mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-03 01:28:12 +08:00
Fix boolean crash with self intersecting shape (#952)
This commit is contained in:
committed by
Keavon Chambers
parent
04059f55b9
commit
5a34b3a966
@@ -25,6 +25,7 @@ pub enum BooleanOperationError {
|
|||||||
NoIntersections,
|
NoIntersections,
|
||||||
NothingDone, // Not necessarily an error
|
NothingDone, // Not necessarily an error
|
||||||
DirectionUndefined,
|
DirectionUndefined,
|
||||||
|
NoResult,
|
||||||
Unexpected, // For debugging, when complete nothing should be unexpected
|
Unexpected, // For debugging, when complete nothing should be unexpected
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,9 +493,13 @@ pub fn composite_boolean_operation(mut select: BooleanOperation, shapes: &mut Ve
|
|||||||
match partial_union {
|
match partial_union {
|
||||||
Ok(temp_union) => {
|
Ok(temp_union) => {
|
||||||
// The result of a successful union will be exactly one shape
|
// The result of a successful union will be exactly one shape
|
||||||
shapes.push(RefCell::new(temp_union.into_iter().next().unwrap()));
|
if let Some(result) = temp_union.into_iter().next() {
|
||||||
shapes.swap_remove(subject_idx);
|
shapes.push(RefCell::new(result));
|
||||||
shapes.swap_remove(shape_idx);
|
shapes.swap_remove(subject_idx);
|
||||||
|
shapes.swap_remove(shape_idx);
|
||||||
|
} else {
|
||||||
|
return Err(BooleanOperationError::NoResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(BooleanOperationError::NothingDone) => shape_idx += 1,
|
Err(BooleanOperationError::NothingDone) => shape_idx += 1,
|
||||||
Err(err) => return Err(err),
|
Err(err) => return Err(err),
|
||||||
|
|||||||
Reference in New Issue
Block a user