From 89f2d6e764eb155c7d159425f63b7c80e4ad19d3 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Wed, 10 May 2017 09:29:23 -0700 Subject: [PATCH] Check oid before calling localCommitsRelative to avoid crashes --- pass/Models/PasswordStore.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pass/Models/PasswordStore.swift b/pass/Models/PasswordStore.swift index 1da7e0b..44641a4 100644 --- a/pass/Models/PasswordStore.swift +++ b/pass/Models/PasswordStore.swift @@ -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) }