[RFC/PATCH 2/6] transport_get(): Don't SEGFAULT on missing url

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Johan Herland <johan@xxxxxxxxxxx>
---
 transport.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/transport.c b/transport.c
index 19f330a..26d9999 100644
--- a/transport.c
+++ b/transport.c
@@ -820,14 +820,15 @@ struct transport *transport_get(struct remote *remote, const char *url)
 		return ret;
 	}
 
-	if (!prefixcmp(url, "rsync:")) {
+	if (url && !prefixcmp(url, "rsync:")) {
 		ret->get_refs_list = get_refs_via_rsync;
 		ret->fetch = fetch_objs_via_rsync;
 		ret->push = rsync_transport_push;
 
-	} else if (!prefixcmp(url, "http://";)
-	        || !prefixcmp(url, "https://";)
-	        || !prefixcmp(url, "ftp://";)) {
+	} else if (url
+	        && (!prefixcmp(url, "http://";)
+	         || !prefixcmp(url, "https://";)
+	         || !prefixcmp(url, "ftp://";))) {
 		transport_helper_init(ret);
 #ifdef NO_CURL
 		error("git was compiled without libcurl support.");
@@ -835,7 +836,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
 		ret->push = curl_transport_push;
 #endif
 
-	} else if (is_local(url) && is_file(url)) {
+	} else if (url && is_local(url) && is_file(url)) {
 		struct bundle_transport_data *data = xcalloc(1, sizeof(*data));
 		ret->data = data;
 		ret->get_refs_list = get_refs_from_bundle;
-- 
1.6.4.rc3.138.ga6b98.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]