diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2017-03-28 19:34:05 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-28 11:12:36 -0700 |
commit | 1d0281c9234e44ce4804f8c7f376cd9d4ee68f54 (patch) | |
tree | 22d5de159d50b884650ceda59b9031133a1677a5 | |
parent | ec7206a475660eda0f2cf7d2ca8dd638bdc26745 (diff) | |
download | subsurface-1d0281c9234e44ce4804f8c7f376cd9d4ee68f54.tar.gz |
Fix a crash when git init fails
This can occur e.g. if directory permissions prevent one from writing to
the local cloud storage directory. (Such a crash was discussed on
mailing list.) The error message on GUI is misleading, claiming that
cloud connection failed...
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
---
We probably should check the return value of other git operations as
well, but going for bare minimum for now.
-rw-r--r-- | core/git-access.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/git-access.c b/core/git-access.c index ac4ac80af..5aca509db 100644 --- a/core/git-access.c +++ b/core/git-access.c @@ -648,6 +648,11 @@ static int repository_create_cb(git_repository **out, const char *path, int bare git_config *conf; int ret = git_repository_init(out, path, bare); + if (ret != 0) { + if (verbose) + fprintf(stderr, "Initializing git repository failed\n"); + return ret; + } git_repository_config(&conf, *out); if (getProxyString(&proxy_string)) { |