summaryrefslogtreecommitdiff
path: root/fetch.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-07-29 00:10:07 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-29 00:13:00 (GMT)
commit1b03dfed182a1dc47cc0eb1047a34cd914440ce6 (patch)
tree90b436b26aa7fc222ecca0e9d9846136c71e6d8a /fetch.c
parentfff8fd5b1ee9c13694c29ba3544f5b1ebf0f4fb2 (diff)
downloadgit-1b03dfed182a1dc47cc0eb1047a34cd914440ce6.zip
git-1b03dfed182a1dc47cc0eb1047a34cd914440ce6.tar.gz
git-1b03dfed182a1dc47cc0eb1047a34cd914440ce6.tar.bz2
Fix http-fetch
With the latest changes in fetch.c, http-fetch crashed accessing write_ref[i], where write_ref was NULL. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'fetch.c')
-rw-r--r--fetch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fetch.c b/fetch.c
index 2151c7b..aeb6bf2 100644
--- a/fetch.c
+++ b/fetch.c
@@ -245,7 +245,7 @@ void pull_targets_free(int targets, char **target, const char **write_ref)
{
while (targets--) {
free(target[targets]);
- if (write_ref[targets])
+ if (write_ref && write_ref[targets])
free((char *) write_ref[targets]);
}
}
@@ -263,7 +263,7 @@ int pull(int targets, char **target, const char **write_ref,
track_object_refs = 0;
for (i = 0; i < targets; i++) {
- if (!write_ref[i])
+ if (!write_ref || !write_ref[i])
continue;
lock[i] = lock_ref_sha1(write_ref[i], NULL, 0);
@@ -295,7 +295,7 @@ int pull(int targets, char **target, const char **write_ref,
msg = NULL;
}
for (i = 0; i < targets; i++) {
- if (!write_ref[i])
+ if (!write_ref || !write_ref[i])
continue;
ret = write_ref_sha1(lock[i], &sha1[20 * i], msg ? msg : "fetch (unknown)");
lock[i] = NULL;