remote.c: guard config parser from value=NULL
branch.*.{remote,merge} expect a string value Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Feb 11, 2008 at 11:00 UTC
d2370cc2960d3b0a090c57dfea99209c59b515f7
1 file changed
+6
-3
remote.c
+6
-3
@@ -222,15 +222,18 @@ static int handle_config(const char *key, const char *value)
222
subkey = strrchr(name, '.');
223
if (!subkey)
224
return 0;
225
- if (!value)
226
- return 0;
225
branch = make_branch(name, subkey - name);
226
if (!strcmp(subkey, ".remote")) {
227
+ if (!value)
228
+ return config_error_nonbool(key);
229
branch->remote_name = xstrdup(value);
230
if (branch == current_branch)
231
default_remote_name = branch->remote_name;
232
- } else if (!strcmp(subkey, ".merge"))
232
+ } else if (!strcmp(subkey, ".merge")) {
233
+ if (!value)
234
+ return config_error_nonbool(key);
235
add_merge(branch, xstrdup(value));
236
+ }
237
return 0;
238
}
239
if (prefixcmp(key, "remote."))