Check oid before calling localCommitsRelative to avoid crashes

This commit is contained in:
Bob Sun 2017-05-10 09:29:23 -07:00
parent 20f2e22076
commit 89f2d6e764
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -755,6 +755,11 @@ class PasswordStore {
}
let remoteMasterBranch = try storeRepository.remoteBranches()[index]
// check oid before calling localCommitsRelative
guard remoteMasterBranch.oid != nil else {
throw AppError.RepositoryRemoteMasterNotFoundError
}
// get a list of local commits
return try storeRepository.localCommitsRelative(toRemoteBranch: remoteMasterBranch)
}