|
@@ -3234,8 +3234,20 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- let image = NSImage(contentsOfFile: url.path)
|
|
|
|
- let isDamageImage: Bool = self.isDamageImage(image!, imagePath: url.path)
|
|
|
|
|
|
+ guard let image = NSImage(contentsOfFile: url.path) else {
|
|
|
|
+ let alert = NSAlert()
|
|
|
|
+ alert.alertStyle = .critical
|
|
|
|
+ alert.messageText = String(format: NSLocalizedString("The file \"%@\" could not be opened.", comment: ""), url.lastPathComponent)
|
|
|
|
+ alert.informativeText = NSLocalizedString("It may be damaged or use a file format that PDF Reader Pro doesn’t recognize.", comment: "")
|
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
|
|
|
|
+ alert.beginSheetModal(for: NSApp.mainWindow!) { (response) in
|
|
|
|
+ if response == .alertFirstButtonReturn {
|
|
|
|
+ // Handle cancel button clicked
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ let isDamageImage: Bool = self.isDamageImage(image, imagePath: url.path)
|
|
if isDamageImage {
|
|
if isDamageImage {
|
|
let alert = NSAlert()
|
|
let alert = NSAlert()
|
|
alert.alertStyle = .critical
|
|
alert.alertStyle = .critical
|
|
@@ -3247,6 +3259,7 @@ extension KMMainViewController {
|
|
// Handle cancel button clicked
|
|
// Handle cancel button clicked
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return
|
|
}
|
|
}
|
|
let isRemoveBGColor = accessoryCtr.selectedButton.state == .on
|
|
let isRemoveBGColor = accessoryCtr.selectedButton.state == .on
|
|
listView.addAnnotation(with: image, isRemoveBGColor: isRemoveBGColor)
|
|
listView.addAnnotation(with: image, isRemoveBGColor: isRemoveBGColor)
|