Do not show 0 if numbers in "About Repository" cannot be obtained properly

This commit is contained in:
Danny Moesch 2019-01-07 20:21:04 +01:00 committed by Mingshen Sun
parent f47e7d384c
commit 744b46adc2
3 changed files with 18 additions and 12 deletions

View file

@ -105,16 +105,16 @@ public class PasswordStore {
return (try? fm.allocatedSizeOfDirectoryAtURL(directoryURL: self.storeURL)) ?? 0
}
public var numberOfLocalCommits: Int {
return (try? getLocalCommits()?.count ?? 0) ?? 0
public var numberOfLocalCommits: Int? {
return (try? getLocalCommits())?.flatMap { $0.count }
}
public var lastSyncedTime: Date? {
return SharedDefaults[.lastSyncedTime]
}
public var numberOfCommits: UInt {
return storeRepository?.numberOfCommits(inCurrentBranch: nil) ?? 0
public var numberOfCommits: UInt? {
return storeRepository?.numberOfCommits(inCurrentBranch: nil)
}
private init() {