فهرست منبع

【APPCenter】Crash编号:96

liujiajie 10 ماه پیش
والد
کامیت
d706036e81

+ 11 - 7
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -50,16 +50,20 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
     var currentDocumentSetup: [String: Any] {
         get {
             var tempSetup: [String: Any] = [:]
-            var tempMainSetup: [String: Any] = mainViewController?.currentSetup() ?? [:]
-            let data = (fileURL != nil) ? SKAlias.init(url: fileURL).data : nil
+            let tempMainSetup: [String: Any] = mainViewController?.currentSetup() ?? [:]
             let filePath = fileURL?.path ?? ""
-            
-            tempSetup.updateValue(filePath, forKey: KMDocumentSetupFileNameKey)
-            if data != nil {
-                tempSetup.updateValue(data!, forKey: KMDocumentSetupAliasKey)
+            if filePath.count > 0{
+                tempSetup.updateValue(filePath, forKey: KMDocumentSetupFileNameKey)
+            }else {
+                return tempSetup
+            }
+            if let alias = SKAlias.init(url: fileURL){
+                if let data = alias.data{
+                    tempSetup.updateValue(data as Any, forKey: KMDocumentSetupAliasKey)
+                }
             }
             
-            if tempSetup.count != 0 {
+            if tempSetup.count > 0 {
                 tempSetup.merge(tempMainSetup) { (_, new) in new }
             }
             return tempSetup

+ 3 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -2228,6 +2228,9 @@ extension KMMainViewController {
         var setup: [String: Any] = [:]
         var point = NSZeroPoint
 //        var rotated = listView.currentPage().rotation
+        if listView == nil {
+            return setup
+        }
         let pageIndex = listView.currentPageIndexAndPoint(&point, rotated: nil)
         
         setup[kWindowFrameKey] = NSStringFromRect(mainWindow?.frame ?? NSZeroRect)