Commit 43c6dd6fb02ec253b7e8aaf249d0070b253a6c83

Vicent Martí 2012-01-18T15:29:51

Merge pull request #537 from nulltoken/fix/download-segfault Fix download segfault

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/refspec.c b/src/refspec.c
index 7ce32ba..7694be5 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -57,7 +57,7 @@ const char *git_refspec_dst(const git_refspec *refspec)
 
 int git_refspec_src_match(const git_refspec *refspec, const char *refname)
 {
-	return refspec == NULL ? GIT_ENOMATCH : git__fnmatch(refspec->src, refname, 0);
+	return (refspec == NULL || refspec->src == NULL) ? GIT_ENOMATCH : git__fnmatch(refspec->src, refname, 0);
 }
 
 int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, const char *name)