Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch node regression bug #815

Closed
josh-shaw-dev opened this issue Mar 1, 2016 · 1 comment
Closed

Catch node regression bug #815

josh-shaw-dev opened this issue Mar 1, 2016 · 1 comment

Comments

@josh-shaw-dev
Copy link
Contributor

Version affected 0.13.3 possibly other versions depending on when the changes to the catch node were done.
Nodejs version used 4.2.6 - shouldn't really matter but here for completeness

Catch node has a regression bug where It cannot import a catch node from older flow. And bugs the editor to push all nodes into the top left of the screen.

Throws - TypeError: Cannot read property 'length' of undefined

import_flow

Example flow that will bug the editor:
[{"id":"7c1d630a.83e29c","type":"catch","name":"Catch Everything","x":773,"y":613,"z":"144a3a03.ebb5c6","wires":[[]]}]

line 4736 in node-red/public/red/red.js is calling the label function of the catch node and it throws an error.
l = (typeof l === "function" ? l.call(d) : l)||"";

The label function that the above code is calling. Was logged out while i was debugging.
Offending code actually comes from node-red/nodes/core/core/25-catch.html
line 109

function () {
            return this.name||this.scope?this._("catch.catchNodes",{number:this.scope.length}):this._("catch.catch");
        }

Stack trace from browser

TypeError: Cannot read property 'length' of undefined
    at Object.RED.nodes.registerType.label (eval at <anonymous> (http://localhost:8079/admin/vendor/vendor.js:2:2622), <anonymous>:13:86)
    at SVGGElement.<anonymous> (http://localhost:8079/admin/red/red.js:4739:54)
    at http://localhost:8079/admin/vendor/vendor.js:1143:9360
    at Tn (http://localhost:8079/admin/vendor/vendor.js:1141:8521)
    at Array.Ma.each (http://localhost:8079/admin/vendor/vendor.js:1143:9334)
    at redraw (http://localhost:8079/admin/red/red.js:4734:23)
    at Object.importNodes (http://localhost:8079/admin/red/red.js:5316:17)
    at HTMLDivElement.$.appendTo.dialog.buttons.click (http://localhost:8079/admin/red/red.js:7833:38)
    at HTMLButtonElement.s.click (http://localhost:8079/admin/vendor/vendor.js:17:9472)
    at HTMLButtonElement.m.event.dispatch (http://localhost:8079/admin/vendor/vendor.js:4:8549)
red.js:4733 [Array[2]]
@knolleary
Copy link
Member

Ooo nasty. Thanks for spotting this.

Will fix the Catch node and put some error handling in the view rendering to ensure a node can't cause this in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants