summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-04 22:12:10 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-04 22:12:10 +0100
commitb15b204f4958f039573868c02093f3aa2ae48e98 (patch)
treea26eeeb6ae1a9f14e4d4a305936a6f8ba911d7af /content
parent05c6ee02d99ea04dde6687d94508b40f4393f77b (diff)
downloadnetsurf-b15b204f4958f039573868c02093f3aa2ae48e98.tar.gz
netsurf-b15b204f4958f039573868c02093f3aa2ae48e98.tar.bz2
form: Fix situation where a gadget initialises with NULL value
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content')
-rw-r--r--content/handlers/html/form.c8
1 files changed, 6 insertions, 2 deletions
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;