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>
This commit is contained in:
Dirk Hohndel 2017-10-26 15:52:45 +02:00
parent f088aa4c8b
commit 3b92585a47

View file

@ -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();