Explorar el Código

【fix】【Form】添加列表框,点击外观的A,崩溃一次

tangchao hace 4 meses
padre
commit
30875a215d

+ 3 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/WindowController/KMAnnotationFontWindowController.swift

@@ -233,7 +233,9 @@ class KMFontModel: NSObject {
             DispatchQueue.main.async { [weak self] in
                 guard let self = self else { return }
                 self.fontComboBox.menu = menu
-                self.fontComboBox.selectItem(at: selectedIndex)
+                if selectedIndex >= 0 && selectedIndex < menu.items.count {
+                    self.fontComboBox.selectItem(at: selectedIndex)
+                }
                 
                 let selectedStyleIndex = self.setFontStyle(fontName: self.annotationFontModel!.fontName, currentStyle: self.annotationFontModel!.fontWeight)
                 self.fontWeightPopUpButton.selectItem(at: Int(selectedStyleIndex))