From b15b204f4958f039573868c02093f3aa2ae48e98 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 4 Aug 2019 22:12:10 +0100 Subject: form: Fix situation where a gadget initialises with NULL value Signed-off-by: Daniel Silverstone --- content/handlers/html/form.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'content/handlers/html/form.c') diff --git a/content/handlers/html/form.c b/content/handlers/html/form.c index e8461cdcf..2918ce7d2 100644 --- a/content/handlers/html/form.c +++ b/content/handlers/html/form.c @@ -2269,8 +2269,12 @@ form_gadget_sync_with_dom(struct form_control *control) control->syncing = true; /* If we've changed value, sync that toward the DOM */ - if ((control->last_synced_value == NULL && control->value[0] != '\0') || - (control->last_synced_value != NULL && strcmp(control->value, control->last_synced_value) != 0)) { + if ((control->last_synced_value == NULL && + control->value != NULL && + control->value[0] != '\0') || + (control->last_synced_value != NULL && + control->value != NULL && + strcmp(control->value, control->last_synced_value) != 0)) { char *dup = strdup(control->value); if (dup == NULL) { goto out; -- cgit v1.2.3