From 1d0281c9234e44ce4804f8c7f376cd9d4ee68f54 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Tue, 28 Mar 2017 19:34:05 +0300 Subject: 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 --- We probably should check the return value of other git operations as well, but going for bare minimum for now. --- core/git-access.c | 5 +++++ 1 file changed, 5 insertions(+) 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)) { -- cgit v1.2.3-70-g09d2