aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--decode.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/decode.c b/decode.c
index 486e7cd..a0fcac2 100644
--- a/decode.c
+++ b/decode.c
@@ -491,6 +491,18 @@ gemtext_list_decode(char *text)
ret = append;
}
+ /*
+ * if this is reached, it means there was no text to parse
+ * therefore NULL would be returned, but we don't want that
+ * because it is the error indicator, so we'll create an
+ * empty list
+ */
+ if (ret == NULL) {
+ ret = malloc(sizeof(*ret));
+ if (ret == NULL)
+ return NULL;
+ ret[0] = NULL;
+ }
return ret;
}