diff options
Diffstat (limited to 'render/form.c')
-rw-r--r-- | render/form.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/render/form.c b/render/form.c index 096d5d3dd..c9f1abe24 100644 --- a/render/form.c +++ b/render/form.c @@ -50,7 +50,7 @@ static char *form_encode_item(const char *item, const char *charset, * \param target Target frame of form, or NULL for default * \param method method and enctype * \param charset acceptable encodings for form submission, or NULL - * \param doc_charset encoding of containing document + * \param doc_charset encoding of containing document, or NULL * \return a new structure, or NULL on memory exhaustion */ struct form *form_new(void *node, const char *action, const char *target, @@ -59,8 +59,6 @@ struct form *form_new(void *node, const char *action, const char *target, { struct form *form; - assert(doc_charset != NULL); - form = calloc(1, sizeof *form); if (!form) return NULL; @@ -88,8 +86,9 @@ struct form *form_new(void *node, const char *action, const char *target, return NULL; } - form->document_charset = strdup(doc_charset); - if (form->document_charset == NULL) { + form->document_charset = doc_charset != NULL ? strdup(doc_charset) + : NULL; + if (doc_charset && form->document_charset == NULL) { free(form->accept_charsets); free(form->target); free(form->action); |