changeset 22:8d274b012d28

pasterd: fix if code is empty
author David Demelier <markand@malikania.fr>
date Thu, 06 Feb 2020 20:12:00 +0100
parents 21c103c33ac9
children 814b9117b610
files http.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/http.c	Thu Feb 06 20:10:00 2020 +0100
+++ b/http.c	Thu Feb 06 20:12:00 2020 +0100
@@ -650,6 +650,10 @@
 			paste.visible = strcmp(val, "on") != 0;
 	}
 
+	/* Add empty string if needed. */
+	if (!paste.code)
+		paste.code = estrdup("");
+
 	if (!database_insert(&paste))
 		page(req, NULL, KHTTP_500, "500.html");
 	else {