safer code

This commit is contained in:
Niels Lyngsø
2020-02-26 17:03:24 +01:00
parent 4a6484b577
commit e30d90ac7e

View File

@@ -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: "",