summaryrefslogtreecommitdiff
path: root/rule-compiler
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-22 15:52:55 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-22 15:52:55 -0800
commit2ee53b0e7595dacd8a3dca59293577623435d0b2 (patch)
tree8cb88e29e2ee7b43c47b10e236a87294f8563c42 /rule-compiler
parentfb00f0f94ce11dbd9d5c81fc15cf6e408d01c299 (diff)
downloadinfinitytier-2ee53b0e7595dacd8a3dca59293577623435d0b2.tar.gz
infinitytier-2ee53b0e7595dacd8a3dca59293577623435d0b2.zip
Fix bug in default capability flag in rule parser.
Diffstat (limited to 'rule-compiler')
-rw-r--r--rule-compiler/rule-compiler.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/rule-compiler/rule-compiler.js b/rule-compiler/rule-compiler.js
index 1b3599a3..d927e512 100644
--- a/rule-compiler/rule-compiler.js
+++ b/rule-compiler/rule-compiler.js
@@ -838,7 +838,8 @@ function compile(src,rules,caps,tags)
let id = -1;
let dfl = false;
for(let k=1;k<cap.length;++k) {
- if (cap[k][0].toLowerCase() === 'id') {
+ let dn = (typeof cap[k][0] === 'string') ? cap[k][0].toLowerCase() : null;
+ if (dn === 'id') {
if (id >= 0)
return [ cap[k][1],cap[k][2],'Duplicate id directive in capability definition.' ];
if ((k + 1) >= cap.length)
@@ -850,7 +851,7 @@ function compile(src,rules,caps,tags)
if (caps[cn].id === id)
return [ cap[k - 1][1],cap[k - 1][2],'Duplicate capability ID.' ];
}
- } else if (cap[k][0].toLowerCase() === 'default') {
+ } else if (dn === 'default') {
dfl = true;
} else {
capRules.push(cap[k]);