                                   height: textSize.height),
                        withAttributes: textAttributes)
         
-        let snapshot: UIImage = UIGraphicsGetImageFromCurrentImageContext()!;
-        UIGraphicsEndImageContext();
+        guard let snapshot: UIImage = UIGraphicsGetImageFromCurrentImageContext() else { return UIImage() }
+        UIGraphicsEndImageContext()
         
-        return snapshot;
+        return snapshot
     }
 }
 

    
    private func fontForFontName(name: String?) -> UIFont {
        
        let fontSize = self.bounds.width * kFontResizingProportion;
        if name != nil {
            return UIFont(name: name!, size: fontSize)!
        }
        else {
            return UIFont.systemFont(ofSize: fontSize)
        }
        
    }
    
    private func imageSnapshot(text imageText: String, backgroundColor: UIColor, circular: Bool, textAttributes: [NSAttributedString.Key : AnyObject], gradient: Bool, gradientColors: GradientColors) -> UIImage {

        
        UIGraphicsBeginImageContextWithOptions(size, false, scale)
        
        guard let context: CGContext = UIGraphicsGetCurrentContext() else { return UIImage() }
        
        if circular {
            // Clip context to a circle
