summaryrefslogtreecommitdiffstats
path: root/subsurfacestartup.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-06 10:10:08 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-06 10:10:08 +0100
commitc75ec7a04ab14c906c3e58febf142ffb8f73b8bc (patch)
treef7dc33e3830b6e713ffd3c313514f9ffb02a2c69 /subsurfacestartup.c
parent2e6afb8e8900739080e9df206546913d5da06a12 (diff)
downloadsubsurface-c75ec7a04ab14c906c3e58febf142ffb8f73b8bc.tar.gz
Detect if variables were not initialized
In print_files() it is possible that is_git_repository() actually doesn't initialize remote and branch. Don't access them if they were not set up correctly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurfacestartup.c')
-rw-r--r--subsurfacestartup.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index ea57394e8..33aa9fb72 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -139,15 +139,20 @@ static void print_version()
void print_files()
{
- const char *branchp, *remote;
+ const char *branch = 0;
+ const char *remote = 0;
const char *filename, *local_git;
filename = cloud_url();
- is_git_repository(filename, &branchp, &remote, true);
- local_git = get_local_dir(remote, branchp);
+ is_git_repository(filename, &branch, &remote, true);
printf("\nFile locations:\n\n");
- printf("Local git storage: %s\n", local_git);
+ 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");
+ }
printf("Cloud URL: %s\n", cloud_url());
printf("Image hashes: %s\n", hashfile_name_string());
printf("Local picture directory: %s\n\n", picturedir_string());