mchoe / SwiftSVG

A simple, performant, and lightweight SVG parser
Other
1.92k stars 229 forks source link

Fatal error: UIColor+Extensions.swift, line 176 #162

Open AlexMcX opened 4 years ago

AlexMcX commented 4 years ago

Description of the Issue Fatal error: Unexpectedly found nil while unwrapping an Optional value: file ~Pods/SwiftSVG/SwiftSVG/SVG/Helpers/UIColor+Extensions.swift, line 176

Sample SVG https://static.openfintech.io/payment_methods/piastrix/icon.svg

FIX internal convenience init?(svgString: String) {

    if svgString.hasPrefix("#") {`
        self.init(hexString: svgString)`
        return`
    }

    if svgString.hasPrefix("rgba") {
        self.init(rgbaString: svgString)
        return
    }

    if svgString.hasPrefix("rgb") {
        self.init(rgbString: svgString)
        return
    }

    self.init(cssName: svgString)
}
cornerAnt commented 4 years ago

me too