mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Fix crash on deleting all subpaths (#1460)
* Fix crash on deleting all subpaths * Delete layer if no manipulators exist
This commit is contained in:
@@ -141,6 +141,9 @@ impl<ManipulatorGroupId: crate::Identifier> Subpath<ManipulatorGroupId> {
|
||||
|
||||
/// Write the curve argument to the string (the d="..." part)
|
||||
pub fn subpath_to_svg(&self, svg: &mut String, transform: glam::DAffine2) -> std::fmt::Result {
|
||||
if self.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let start = transform.transform_point2(self[0].anchor);
|
||||
write!(svg, "{SVG_ARG_MOVE}{},{}", start.x, start.y)?;
|
||||
for bezier in self.iter() {
|
||||
|
||||
@@ -51,6 +51,9 @@ impl<ManipulatorGroupId: crate::Identifier> Iterator for SubpathIter<'_, Manipul
|
||||
|
||||
// Returns the Bezier representation of each `Subpath` segment, defined between a pair of adjacent manipulator points.
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
if self.subpath.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let len = self.subpath.len() - 1
|
||||
+ match self.subpath.closed {
|
||||
true => 1,
|
||||
|
||||
Reference in New Issue
Block a user