Explorar o código

【APPCenter】Crash编号:92 -- 修复

lizhe hai 10 meses
pai
achega
fea04ea933

+ 10 - 7
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationFromViewController.swift

@@ -171,19 +171,22 @@ import Cocoa
     // MARK: Private Method
     
     func reloadData() {
+        guard let fillColorPickerView = fillColorPickerView else { return }
+        guard let annotation = self.annotation else { return }
         if annotations.count > 0 {
-            if let presetValue = annotation?.buttonWidgetStateString() {
-                annotation?.setButtonWidgetStateString(presetValue)
+            if let presetValue = annotation.buttonWidgetStateString() {
+                annotation.setButtonWidgetStateString(presetValue)
             }
             var opacity: CGFloat = 1
-            let color = annotation!.backgroundColor
+            let color = annotation.backgroundColor
             if color != nil {
                 color!.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green:nil, blue: nil, alpha: &opacity)
             }
 
-            let fontColor = self.annotation!.fontColor
-            if let isTextWidget = (annotation?.isKind(of: CPDFTextWidgetAnnotation.self)), isTextWidget {
-                fillColorPickerView!.color = color
+            let fontColor = annotation.fontColor
+            let isTextWidget = (annotation.isKind(of: CPDFTextWidgetAnnotation.self))
+            if isTextWidget {
+                fillColorPickerView.color = color
                 colorPickerView.color = fontColor
                 
                 fontSizeComboBox.stringValue = String(format: "%.f pt", ((annotation as! CPDFTextWidgetAnnotation).font.pointSize))
@@ -230,7 +233,7 @@ import Cocoa
             }
 
             let fontColor = annotationModel.fontColor()
-            fillColorPickerView!.color = color
+            fillColorPickerView.color = color
             colorPickerView.color = fontColor
             fontSizeComboBox.stringValue = String(format: "%.f pt", (annotationModel.fontSize() ?? 12))