fix: check if `node.prop` is defined

This commit is contained in:
Michael Maier 2021-11-28 15:35:56 +01:00
parent c2db1d4d44
commit 28bb07d415
1 changed files with 9 additions and 7 deletions

View File

@ -325,14 +325,16 @@ const rect = (parent, node) => {
.attr('width', totalWidth)
.attr('height', totalHeight);
const propKeys = new Set(Object.keys(node.props));
if (node.props?.borders) {
applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight);
propKeys.delete('borders');
if (node.props) {
const propKeys = new Set(Object.keys(node.props));
if (node.props.borders) {
applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight);
propKeys.delete('borders');
}
propKeys.forEach((propKey) => {
log.warn(`Unknown node property ${propKey}`);
});
}
propKeys.forEach((propKey) => {
log.warn(`Unknown node property ${propKey}`);
});
updateNodeBounds(node, rect);