Skip to content

Commit ac502de

Browse files
committed
Optional Offset
1 parent 72138e3 commit ac502de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

SwiftDraw/Parser.XML.Gradient.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ extension XMLParser {
6868
}
6969

7070
func parseLinearGradientStop(_ att: AttributeParser) throws -> DOM.LinearGradient.Stop {
71-
let offset: DOM.Float = try att.parsePercentage("offset")
71+
let offset: DOM.Float? = try? att.parsePercentage("offset")
7272
let color: DOM.Color = try att.parseFill("stop-color").getColor()
7373
let opacity: DOM.Float? = try att.parsePercentage("stop-opacity")
74-
return DOM.LinearGradient.Stop(offset: offset, color: color, opacity: opacity ?? 1.0)
74+
return DOM.LinearGradient.Stop(offset: offset ?? 0, color: color, opacity: opacity ?? 1.0)
7575
}
7676
}

0 commit comments

Comments
 (0)