Skip to content

Commit

Permalink
remote.c: guard config parser from value=NULL
Browse files Browse the repository at this point in the history
branch.*.{remote,merge} expect a string value

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Feb 11, 2008
1 parent e098368 commit d2370cc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,18 @@ static int handle_config(const char *key, const char *value)
subkey = strrchr(name, '.');
if (!subkey)
return 0;
if (!value)
return 0;
branch = make_branch(name, subkey - name);
if (!strcmp(subkey, ".remote")) {
if (!value)
return config_error_nonbool(key);
branch->remote_name = xstrdup(value);
if (branch == current_branch)
default_remote_name = branch->remote_name;
} else if (!strcmp(subkey, ".merge"))
} else if (!strcmp(subkey, ".merge")) {
if (!value)
return config_error_nonbool(key);
add_merge(branch, xstrdup(value));
}
return 0;
}
if (prefixcmp(key, "remote."))
Expand Down

0 comments on commit d2370cc

Please sign in to comment.