diff --git a/common/git/kicad_git_common.cpp b/common/git/kicad_git_common.cpp index 6d3b2e5736..a9b7296d83 100644 --- a/common/git/kicad_git_common.cpp +++ b/common/git/kicad_git_common.cpp @@ -48,6 +48,7 @@ git_repository* KIGIT_COMMON::GetRepo() const wxString KIGIT_COMMON::GetCurrentBranchName() const { + wxCHECK( m_repo, wxEmptyString ); git_reference* head = nullptr; int retval = git_repository_head( &head, m_repo ); @@ -80,6 +81,7 @@ wxString KIGIT_COMMON::GetCurrentBranchName() const std::vector KIGIT_COMMON::GetBranchNames() const { + wxCHECK( m_repo, {} ); std::vector branchNames; std::map branchNamesMap; wxString firstName; @@ -133,6 +135,7 @@ std::vector KIGIT_COMMON::GetBranchNames() const std::vector KIGIT_COMMON::GetProjectDirs() { + wxCHECK( m_repo, {} ); std::vector projDirs; git_oid oid; @@ -366,6 +369,7 @@ bool KIGIT_COMMON::HasLocalCommits() const bool KIGIT_COMMON::HasPushAndPullRemote() const { + wxCHECK( m_repo, false ); git_remote* remote = nullptr; if( git_remote_lookup( &remote, m_repo, "origin" ) != GIT_OK ) @@ -393,6 +397,8 @@ bool KIGIT_COMMON::HasPushAndPullRemote() const wxString KIGIT_COMMON::GetRemotename() const { + wxCHECK( m_repo, wxEmptyString ); + wxString retval; git_reference* head = nullptr; git_reference* upstream = nullptr; @@ -500,6 +506,8 @@ void KIGIT_COMMON::updatePublicKeys() void KIGIT_COMMON::UpdateCurrentBranchInfo() { + wxCHECK( m_repo, /* void */ ); + // We want to get the current branch's upstream url as well as the stored password // if one exists given the url and username.