|
@@ -46,14 +46,13 @@ import Cocoa
|
|
|
func reloadData() {
|
|
|
if filePath.count != 0 {
|
|
|
let attribe = try?FileManager.default.attributesOfItem(atPath: filePath)
|
|
|
- fileSize = attribe?[FileAttributeKey.size] as! CGFloat
|
|
|
+ fileSize = attribe?[FileAttributeKey.size] as? CGFloat ?? 0
|
|
|
|
|
|
let document = CPDFDocument.init(url: URL(fileURLWithPath: filePath))
|
|
|
document?.unlock(withPassword: self.password)
|
|
|
- isLocked = document!.isLocked
|
|
|
+ isLocked = document?.isLocked ?? false
|
|
|
self.pdfDocument = document
|
|
|
|
|
|
-
|
|
|
let page = document?.page(at: 0) ?? CPDFPage()
|
|
|
let image = page.thumbnail(of: page.size)
|
|
|
fileImage = image ?? NSImage()
|