summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAli Fardan <raiz@stellarbound.space>2020-11-22 13:25:43 +0300
committerAli Fardan <raiz@stellarbound.space>2020-11-22 13:25:43 +0300
commit7ea4eb3fe07564f605731b4b4eef09a47c0bfb08 (patch)
tree82df80cf63088a25cca50ddfb77d82487b543a2c
parent8df738163593a6e2589407b185039930ce599f02 (diff)
downloadlibyuri-7ea4eb3fe07564f605731b4b4eef09a47c0bfb08.tar.gz
normalize: don't expect scheme to be present
-rw-r--r--normalize.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/normalize.c b/normalize.c
index ec8fd9e..f8e8dbe 100644
--- a/normalize.c
+++ b/normalize.c
@@ -33,9 +33,11 @@ uri_normalize(struct uri *u)
 {
 	int i;
 
-	for (i = 0; i < strlen(u->scheme); i++) {
-		if (isalpha(u->scheme[i]))
-			u->scheme[i] = tolower(u->scheme[i]);
+	if (u->scheme) {
+		for (i = 0; i < strlen(u->scheme); i++) {
+			if (isalpha(u->scheme[i]))
+				u->scheme[i] = tolower(u->scheme[i]);
+		}
 	}
 
 	if (u->authority.host) {