diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index 819e5cc..39f0370 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -964,6 +964,8 @@ soup_uri_host_hash (gconstpointer key)
 {
 	const SoupURI *uri = key;
 
+	g_return_val_if_fail (uri->host != NULL, NULL);
+
 	return GPOINTER_TO_UINT (uri->scheme) + uri->port +
 		soup_str_case_hash (uri->host);
 }
