diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-02-19 14:59:30 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-02-19 14:59:30 +0000 |
commit | b76ef4333a83e8f543411c578433d5db457788de (patch) | |
tree | 356924eb50caaaca782dee5621ebb7c409b7c993 /render | |
parent | d8d0353a734767fcc1211b922820a59303e810a5 (diff) | |
download | netsurf-b76ef4333a83e8f543411c578433d5db457788de.tar.gz netsurf-b76ef4333a83e8f543411c578433d5db457788de.tar.bz2 |
Don't crash if there's no box associated with a textarea
svn path=/trunk/netsurf/; revision=11711
Diffstat (limited to 'render')
-rw-r--r-- | render/form.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/render/form.c b/render/form.c index 6c703692a..3bf5bf550 100644 --- a/render/form.c +++ b/render/form.c @@ -629,6 +629,13 @@ char *form_textarea_value(struct form_control *textarea) char *value, *s; struct box *text_box; + /* Textarea may have no associated box if styled with display: none */ + if (textarea->box == NULL) { + /* Return the empty string: caller treats this as a + * non-successful control. */ + return strdup(""); + } + /* find required length */ for (text_box = textarea->box->children->children; text_box; text_box = text_box->next) { @@ -641,7 +648,8 @@ char *form_textarea_value(struct form_control *textarea) /* construct value */ s = value = malloc(len + 1); if (!s) - return 0; + return NULL; + for (text_box = textarea->box->children->children; text_box; text_box = text_box->next) { if (text_box->type == BOX_TEXT) { |