"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
Get rid of (null) on the index page
To:
gameoftrees@openbsd.org
Date:
Tue, 30 Aug 2022 12:38:27 -0600

Download raw body.

Thread
This gets rid of that very annoying (null) displayed on the index page.

ok?

-- 

Tracey Emery

diff /home/tracey/src/got
commit - 5e91dae4dd43b8024731223110ab18f505f453ac
path + /home/tracey/src/got
blob - 3c69584a92b6b958e709a94fbda0d8de2e82ccf9
file + gotwebd/got_operations.c
--- gotwebd/got_operations.c
+++ gotwebd/got_operations.c
@@ -131,6 +131,9 @@ got_get_repo_owner(char **owner, struct request *c, ch
 		*owner = strdup(gitconfig_owner);
 		if (*owner == NULL)
 			return got_error_from_errno("strdup");
+	} else {
+		if (asprintf(owner, "%s", "") == -1)
+			return got_error_from_errno("asprintf");
 	}
 	return error;
 }
blob - f42caf75b1d7617a6d2c489ec63602ed33a0957d
file + gotwebd/gotweb.c
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
@@ -2058,8 +2058,11 @@ gotweb_get_repo_description(char **description, struct
 		goto done;
 	}
 
-	if (len == 0)
+	if (len == 0) {
+		if (asprintf(description, "%s", "") == -1)
+			return got_error_from_errno("asprintf");
 		goto done;
+	}
 
 	if (fseek(f, 0, SEEK_SET) == -1) {
 		error = got_ferror(f, GOT_ERR_IO);