mirror of
https://github.com/exyte/Macaw.git
synced 2024-11-04 00:39:57 +03:00
Merge pull request #639 from amarunko/svg-parser-pattern-crash-fix
Fix crash in parsing pattern
This commit is contained in:
commit
9df164f79d
@ -465,16 +465,15 @@ open class SVGParser {
|
||||
if let units = element.allAttributes["patternContentUnits"]?.text, units == "objectBoundingBox" {
|
||||
contentUserSpace = false
|
||||
}
|
||||
|
||||
|
||||
var contentNode: Node?
|
||||
if pattern.children.isEmpty {
|
||||
if let parentPattern = parentPattern {
|
||||
contentNode = parentPattern.content
|
||||
}
|
||||
} else if pattern.children.count == 1 {
|
||||
if let shape = try parseNode(pattern.children.first!) as? Shape {
|
||||
contentNode = shape
|
||||
}
|
||||
} else if pattern.children.count == 1,
|
||||
let shape = try parseNode(pattern.children.first!) as? Shape {
|
||||
contentNode = shape
|
||||
} else {
|
||||
var shapes = [Shape]()
|
||||
try pattern.children.forEach { indexer in
|
||||
@ -484,7 +483,7 @@ open class SVGParser {
|
||||
}
|
||||
contentNode = Group(contents: shapes)
|
||||
}
|
||||
|
||||
|
||||
return UserSpacePattern(content: contentNode!,
|
||||
bounds: bounds,
|
||||
userSpace: userSpace,
|
||||
|
Loading…
Reference in New Issue
Block a user