diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-10-26 15:52:45 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-26 15:52:58 +0200 |
commit | 3b92585a47387d1d7e68d99678fb3956117ce416 (patch) | |
tree | d8f2eecdc4b1e0bdf120959d6df202cb83310f4b | |
parent | f088aa4c8b17112855ec86f96a4bac02deb31238 (diff) | |
download | subsurface-3b92585a47387d1d7e68d99678fb3956117ce416.tar.gz |
Don't show error if cloud credentials aren't set up
This became rather obvious with the change to immediately show errors.
The commit also fixes a small memory leak.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | core/subsurfacestartup.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c index c51080cd1..5147b3c37 100644 --- a/core/subsurfacestartup.c +++ b/core/subsurfacestartup.c @@ -163,20 +163,24 @@ void print_files() const char *remote = 0; const char *filename, *local_git; - filename = cloud_url(); - - is_git_repository(filename, &branch, &remote, true); printf("\nFile locations:\n\n"); + if (!same_string(prefs.cloud_storage_email, "") && !same_string(prefs.cloud_storage_password, "")) { + filename = cloud_url(); + + is_git_repository(filename, &branch, &remote, true); + } else { + /* strdup so the free below works in either case */ + filename = strdup("No valid cloud credentials set.\n"); + } if (branch && remote) { local_git = get_local_dir(remote, branch); printf("Local git storage: %s\n", local_git); } else { printf("Unable to get local git directory\n"); } - char *tmp = cloud_url(); - printf("Cloud URL: %s\n", tmp); - free(tmp); - tmp = hashfile_name_string(); + printf("Cloud URL: %s\n", filename); + free((void *)filename); + char *tmp = hashfile_name_string(); printf("Image hashes: %s\n", tmp); free(tmp); tmp = picturedir_string(); |