Browse Source

Fixes #343: segfault when opening bare git repository

merge-requests/365/head
eidheim 8 years ago
parent
commit
9a611b6c89
  1. 4
      src/git.cc

4
src/git.cc

@ -91,6 +91,8 @@ Git::Repository::Repository(const boost::filesystem::path &path) {
});
work_path=get_work_path();
if(work_path.empty())
throw std::runtime_error("Could not find work path");
auto git_path_str=get_path().string();
auto git_directory=Glib::wrap(g_file_new_for_path(git_path_str.c_str())); //TODO: report missing constructor in giomm
@ -271,6 +273,8 @@ std::shared_ptr<Git::Repository> Git::get_repository(const boost::filesystem::pa
}
boost::filesystem::path Git::path(const char *cpath, size_t cpath_length) noexcept {
if(cpath==nullptr)
return boost::filesystem::path();
if(cpath_length==static_cast<size_t>(-1))
cpath_length=strlen(cpath);
if(cpath_length>0 && (cpath[cpath_length-1]=='/' || cpath[cpath_length-1]=='\\'))

Loading…
Cancel
Save