diff --git a/.gitignore b/.gitignore index 83f2765c..3beb7a23 100644 --- a/.gitignore +++ b/.gitignore @@ -141,3 +141,4 @@ tmp/_* docs/docs.md docs/.config/doctest.md docs/roadmap/.~readme.md +documentation/ diff --git a/nodes/elements/elementBuilder.js b/nodes/elements/elementBuilder.js index c4deef71..b8c098ff 100644 --- a/nodes/elements/elementBuilder.js +++ b/nodes/elements/elementBuilder.js @@ -360,7 +360,7 @@ module.exports = { */ buildSForm: function buildSForm(node, msg, parent) { // Make sure node.data is an object or an array - if not, force to array - if (!(Array.isArray(node.data) || node.data.constructor.name === 'Object')) node.data = [node.data] + if (!(Array.isArray(node.data) || (node.data != null && node.data.constructor != null && node.data.constructor.name === 'Object'))) node.data = [node.data] const err = '' @@ -381,6 +381,12 @@ module.exports = { // Data for this row/element of the form: id, type const frmRow = frm[rowRef] + // Check that frmRow is a valid object before processing + if (frmRow == null) { + node.warn(`🌐⚠️[uibuilder:uib-element:elementBuilder:buildSForm] Form row at index ${i} is null or undefined. Skipping.`) + return + } + // TODO Check that required properties are present // Handle non-input inputs