Prevent send-pack from segfaulting when a branch doesn't match
[gitweb.git] / remote.c
index 2166a2bf15d20d5e51696fe3b56e4d66b0b12061..e7d735b98af231610c460c7aa34f12cdd6f37460 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -610,8 +610,11 @@ static int match_explicit(struct ref *src, struct ref *dst,
        if (!matched_src)
                errs = 1;
 
-       if (!dst_value)
+       if (!dst_value) {
+               if (!matched_src)
+                       return errs;
                dst_value = matched_src->name;
+       }
 
        switch (count_refspec_match(dst_value, dst, &matched_dst)) {
        case 1: