diff --git a/Source/svg/SVGParser.swift b/Source/svg/SVGParser.swift index 5bb08a77..f59baeb3 100644 --- a/Source/svg/SVGParser.swift +++ b/Source/svg/SVGParser.swift @@ -1649,12 +1649,12 @@ open class SVGParser { } fileprivate func dimensionFromString(_ string: String) -> SVGLength? { + if string.hasSuffix("%"), let value = Double(string.dropLast()) { + return SVGLength(percent: value) + } if let value = doubleFromString(string) { return SVGLength(pixels: value) } - if string.hasSuffix("%") { - return SVGLength(percent: Double(string.dropLast())!) - } return .none }