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

Property expressions must not be blank

This commit is contained in:
Nick O'Leary 2017-01-06 21:58:17 +00:00
parent c989c533e8
commit 73a41707e5
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 7 additions and 0 deletions

View File

@ -284,6 +284,9 @@ RED.utils = (function() {
// in red/runtime/util.js // in red/runtime/util.js
var length = str.length; var length = str.length;
if (length === 0) {
return false;
}
var start = 0; var start = 0;
var inString = false; var inString = false;
var inBox = false; var inBox = false;

View File

@ -133,6 +133,9 @@ function normalisePropertyExpression(str) {
// in editor/js/ui/utils.js // in editor/js/ui/utils.js
var length = str.length; var length = str.length;
if (length === 0) {
throw new Error("Invalid property expression: zero-length");
}
var parts = []; var parts = [];
var start = 0; var start = 0;
var inString = false; var inString = false;

View File

@ -361,6 +361,7 @@ describe("red/util", function() {
it("fail a[0].[1]",function() { testInvalid("a[0].[1]"); }) it("fail a[0].[1]",function() { testInvalid("a[0].[1]"); })
it("fail a['']",function() { testInvalid("a['']"); }) it("fail a['']",function() { testInvalid("a['']"); })
it("fail 'a.b'c",function() { testInvalid("'a.b'c"); }) it("fail 'a.b'c",function() { testInvalid("'a.b'c"); })
it("fail <blank>",function() { testInvalid("");})
}); });
}); });