mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
2e6afb8e89
commit
c75ec7a04a
1 changed files with 9 additions and 4 deletions
|
@ -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");
|
||||
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());
|
||||
|
|
Loading…
Add table
Reference in a new issue