aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-10-19 05:01:04 +0000
committercorvid <corvid@lavabit.com>2009-10-19 05:01:04 +0000
commita37458eb1e42e0d3398d167a3acd1321cf2f02cd (patch)
tree3f26b0d3d46ea93cddbb172320f8054c0ed04f4a /src
parentb2eebc7a2704a7a945358838ab0d45935fe86a85 (diff)
fix segfault when radio button lacks name attribute
Diffstat (limited to 'src')
-rw-r--r--src/form.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/form.cc b/src/form.cc
index bf1b12e0..0f125c95 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -257,18 +257,20 @@ static void Html_add_input(DilloHtml *html, DilloHtmlInputType type,
*/
static DilloHtmlInput *Html_get_radio_input(DilloHtml *html, const char *name)
{
- lout::misc::SimpleVector<DilloHtmlInput*>* inputs;
-
- if (html->InFlags & IN_FORM)
- inputs = html->getCurrentForm()->inputs;
- else
- inputs = html->inputs_outside_form;
-
- for (int idx = 0; idx < inputs->size(); idx++) {
- DilloHtmlInput *input = inputs->get(idx);
- if (input->type == DILLO_HTML_INPUT_RADIO &&
- input->name && !dStrcasecmp(input->name, name))
- return input;
+ if (name) {
+ lout::misc::SimpleVector<DilloHtmlInput*>* inputs;
+
+ if (html->InFlags & IN_FORM)
+ inputs = html->getCurrentForm()->inputs;
+ else
+ inputs = html->inputs_outside_form;
+
+ for (int idx = 0; idx < inputs->size(); idx++) {
+ DilloHtmlInput *input = inputs->get(idx);
+ if (input->type == DILLO_HTML_INPUT_RADIO &&
+ input->name && !dStrcasecmp(input->name, name))
+ return input;
+ }
}
return NULL;
}