remote.c: guard config parser from value=NULL
branch.*.{remote,merge} expect a string value Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e098368b5b
commit
d2370cc296
9
remote.c
9
remote.c
@ -222,15 +222,18 @@ static int handle_config(const char *key, const char *value)
|
|||||||
subkey = strrchr(name, '.');
|
subkey = strrchr(name, '.');
|
||||||
if (!subkey)
|
if (!subkey)
|
||||||
return 0;
|
return 0;
|
||||||
if (!value)
|
|
||||||
return 0;
|
|
||||||
branch = make_branch(name, subkey - name);
|
branch = make_branch(name, subkey - name);
|
||||||
if (!strcmp(subkey, ".remote")) {
|
if (!strcmp(subkey, ".remote")) {
|
||||||
|
if (!value)
|
||||||
|
return config_error_nonbool(key);
|
||||||
branch->remote_name = xstrdup(value);
|
branch->remote_name = xstrdup(value);
|
||||||
if (branch == current_branch)
|
if (branch == current_branch)
|
||||||
default_remote_name = branch->remote_name;
|
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));
|
add_merge(branch, xstrdup(value));
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (prefixcmp(key, "remote."))
|
if (prefixcmp(key, "remote."))
|
||||||
|
Loading…
Reference in New Issue
Block a user