From e30d90ac7e84fa1f88e153a8db0c66e6d1295e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 26 Feb 2020 17:03:24 +0100 Subject: [PATCH] safer code --- .../src/common/services/blockeditor.service.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/blockeditor.service.js b/src/Umbraco.Web.UI.Client/src/common/services/blockeditor.service.js index 6ed5b27211..a4f7ca9e7b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/blockeditor.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/blockeditor.service.js @@ -85,12 +85,13 @@ this.blockConfigurations.forEach(blockConfiguration => { var scaffold = this.getScaffoldFor(blockConfiguration.contentTypeAlias); - - blocks.push({ - alias: scaffold.contentTypeAlias, - name: scaffold.contentTypeName, - icon: scaffold.icon - }); + if(scaffold) { + blocks.push({ + alias: scaffold.contentTypeAlias, + name: scaffold.contentTypeName, + icon: scaffold.icon + }); + } }); return blocks; @@ -110,6 +111,11 @@ var blockConfiguration = this.getBlockConfiguration(contentModel.contentTypeAlias); + if (blockConfiguration === null) { + // This is not an allowed block type, therefor we return null; + return null; + } + // TODO: make blockConfiguration the base for model, remeber to make a copy. var model = { label: "",