1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Prevent unknown node from breaking editor

If a node provides a .js file that registers a type
but its .html is empty, then the editor will know about
the type, but there will be no node definition.

This fix handles that in some of the utility functions
for generating node appearance.

This wasn't an exhaustive check for these things - just
some obvious candidates that I hit in testing 'bad' nodes
This commit is contained in:
Nick O'Leary 2021-05-13 14:28:01 +01:00
parent 15aa249f64
commit 2bbdc85a29
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -875,6 +875,7 @@ RED.utils = (function() {
}
function getDefaultNodeIcon(def,node) {
def = def || {};
var icon_url;
if (node && node.type === "subflow") {
icon_url = "node-red/subflow.svg";
@ -912,6 +913,7 @@ RED.utils = (function() {
}
function getNodeIcon(def,node) {
def = def || {};
if (node && node.type === '_selection_') {
return "font-awesome/fa-object-ungroup";
} else if (node && node.type === 'group') {
@ -999,6 +1001,7 @@ RED.utils = (function() {
}
function getNodeColor(type, def) {
def = def || {};
var result = def.color;
var paletteTheme = RED.settings.theme('palette.theme') || [];
if (paletteTheme.length > 0) {