From d3c2ecdf90f312a081e7f88e2cb095908c3b33fe Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 18 May 2015 21:31:47 +0200 Subject: [PATCH] Catch exception if g_Git.CheckAndInitDll() fails Signed-off-by: Sven Strickroth --- src/Git/GitRev.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Git/GitRev.cpp b/src/Git/GitRev.cpp index a03584ba3..f8ca380a4 100644 --- a/src/Git/GitRev.cpp +++ b/src/Git/GitRev.cpp @@ -190,11 +190,11 @@ int GitRev::GetParentFromHash(CGitHash &hash) { CAutoLocker lock(g_Git.m_critGitDllSec); - g_Git.CheckAndInitDll(); - GIT_COMMIT commit; try { + g_Git.CheckAndInitDll(); + if (git_get_commit_from_hash(&commit, hash.m_hash)) { m_sErr = _T("git_get_commit_from_hash failed for ") + hash.ToString(); @@ -264,7 +264,15 @@ int GitRev::GetCommit(const CString& refname) CAutoLocker lock(g_Git.m_critGitDllSec); - g_Git.CheckAndInitDll(); + try + { + g_Git.CheckAndInitDll(); + } + catch (char* msg) + { + m_sErr = _T("Could not initiate libgit.\nlibgit reports:\n") + CString(msg); + return -1; + } if(refname.GetLength() >= 8) if(refname.Find(_T("00000000")) == 0) -- 2.11.4.GIT