Fix a crash in ls-remote when refspec expands into nothing
[git/git.git] / remote.c
index e2ca4d3..b20e2be 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -909,7 +909,8 @@ int get_fetch_map(struct ref *remote_refs,
                            rm->peer_ref->name);
        }
 
-       tail_link_ref(ref_map, tail);
+       if (ref_map)
+               tail_link_ref(ref_map, tail);
 
        return 0;
 }