Fix a crash in about repository

This commit is contained in:
Bob Sun 2017-05-25 22:59:53 -07:00
parent dd3c8b9164
commit 086515b5ee
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -51,8 +51,15 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController {
let numberOfPasswordsString = numberFormatter.string(from: NSNumber(value: self.passwordStore.numberOfPasswords))!
let sizeOfRepositoryString = ByteCountFormatter.string(fromByteCount: Int64(self.passwordStore.sizeOfRepositoryByteCount), countStyle: ByteCountFormatter.CountStyle.file)
var numberOfCommits: UInt = 0
let numberOfCommits = self.passwordStore.storeRepository?.numberOfCommits(inCurrentBranch: NSErrorPointer(nilLiteral: ())) ?? 0
do {
if let _ = try self.passwordStore.storeRepository!.currentBranch().oid {
numberOfCommits = self.passwordStore.storeRepository?.numberOfCommits(inCurrentBranch: NSErrorPointer(nilLiteral: ())) ?? 0
}
} catch {
print(error)
}
let numberOfCommitsString = numberFormatter.string(from: NSNumber(value: numberOfCommits))!
DispatchQueue.main.async { [weak self] in