Browse Source

【fix】【APPCenter】Crash编号:29(多页签)

tangchao 10 months ago
parent
commit
3a02904a22

+ 3 - 1
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowser.swift

@@ -240,8 +240,10 @@ import Cocoa
             let index = self.tabStripModel.index(of: currentDocument)
             // 清空数据 [主要清理通知]
             currentDocument.mainViewController?.clearData()
+            if index != kNoTab {
+                self.tabStripModel.detachTabContents(at: index)
+            }
             currentDocument.close()
-            self.tabStripModel.detachTabContents(at: index)
         }
         
         if (self.isCloseAllTabViewItem) {

+ 6 - 1
PDF Office/PDF Master/Class/ChromiumTabs/src/Tab Strip/CTTabStripModel.m

@@ -249,7 +249,12 @@ const int kNoTab = NSNotFound;
 	if ([contentsData_ count] == 0)
 		return NULL;
 	
-	assert([self containsIndex:index]);
+    if ([self containsIndex:index] == false) {
+#if DEBUG
+        assert([self containsIndex:index]);
+#endif
+        return NULL;
+    }
 	
 	CTTabContents* removedContents = [self tabContentsAtIndex:index];
 	int nextActiveIndex =