Skip to content

Commit 331c76d

Browse files
authored
Return [] if node cannot be loaded. Fixes #1991 (#1992)
1 parent cc96c7f commit 331c76d

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/visualizers/panels/ForgeActionButton/ForgeActionButton.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,21 @@ define([
104104
};
105105

106106
ForgeActionButton.prototype.findActionsFor = function(nodeId) {
107-
var node = this.client.getNode(nodeId),
108-
base = this.client.getNode(node.getMetaTypeId()),
109-
isMeta = base && base.getId() === node.getId(),
110-
suffix = isMeta ? '_META' : '',
111-
actions,
107+
const node = this.client.getNode(nodeId);
108+
if (!node) {
109+
return [];
110+
}
111+
let base = this.client.getNode(node.getMetaTypeId());
112+
const isMeta = base && base.getId() === node.getId();
113+
const suffix = isMeta ? '_META' : '';
114+
let actions,
112115
basename;
113116

114117
if (!base) { // must be ROOT or FCO
115118
basename = node.getAttribute('name') || 'ROOT_NODE';
116119
actions = this.getDefinedActionsFor(basename, node)
117120
.filter(action => !action.filter || action.filter.call(this));
118-
return actions.concat(this._registry);
121+
return actions;
119122
}
120123

121124
while (base && !(actions && actions.length)) {
@@ -127,7 +130,7 @@ define([
127130
}
128131
}
129132

130-
return actions.concat(this._registry);
133+
return actions;
131134
};
132135

133136
ForgeActionButton.prototype.getDefinedActionsFor = function(basename, node) {
@@ -148,7 +151,7 @@ define([
148151
};
149152

150153
ForgeActionButton.prototype.addActionsForObject = function(nodeId) {
151-
var actions = this.findActionsFor(nodeId),
154+
var actions = this.findActionsFor(nodeId).concat(this._registry),
152155
i;
153156

154157
// Remove old actions

0 commit comments

Comments
 (0)