From 0fdeaf924bc992323eede90e5594c625ba0e6f10 Mon Sep 17 00:00:00 2001 From: Lumbardh Agaj Date: Fri, 11 Mar 2022 16:18:46 +0100 Subject: [PATCH] fix: finding user properties id error on firefox Firefox inserts a break element in between and is unable to find the id attribute. Check if a child element has id atribute before adding it to the result. --- .../push/frontend/public/javascripts/countly.models.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/push/frontend/public/javascripts/countly.models.js b/plugins/push/frontend/public/javascripts/countly.models.js index ee260e3d726..0e8423523c3 100644 --- a/plugins/push/frontend/public/javascripts/countly.models.js +++ b/plugins/push/frontend/public/javascripts/countly.models.js @@ -1516,9 +1516,13 @@ var htmlElement = document.createElement('div'); htmlElement.innerHTML = localizedMessage[container]; for (var index = 0; index < htmlElement.children.length; index++) { - var idAtribute = htmlElement.children[index].getAttributeNode('id').value; - var idNumber = idAtribute.split('-')[1]; - userPropertyIds.push(idNumber); + var idAttribute = htmlElement.children[index].getAttributeNode('id'); + if (idAttribute && idAttribute.value) { + var idAtributeValue = idAttribute.value; + var idNumber = idAtributeValue.split('-')[1]; + userPropertyIds.push(idNumber); + } + } return userPropertyIds; },