From 9006fca2c82a44dd830b782ee30747cd01522055 Mon Sep 17 00:00:00 2001 From: Jozef Verhoef Date: Tue, 8 Mar 2022 14:36:23 +0100 Subject: [PATCH] Bug #54870: Fix compatibility with PostNL/MyParcel plugin Check that input is present before triggering change event --- assets/js/postcode-eu-autofill.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/postcode-eu-autofill.js b/assets/js/postcode-eu-autofill.js index c5647cc..eb6d0e7 100644 --- a/assets/js/postcode-eu-autofill.js +++ b/assets/js/postcode-eu-autofill.js @@ -116,7 +116,7 @@ { const addressPart = PostcodeNlAddressFieldMapping.mapping[key]; - if (mappedValues.has(addressPart)) + if (mappedValues.has(addressPart) && addressFields[key].length > 0) { const field = addressFields[key].val(mappedValues.get(addressPart))[0]; field.dispatchEvent(new Event('change'));