Commit b629adf2df0ed6aad52bc2e8aab73bbe344786b2

Authored by Adhidarma Hadiwinoto
1 parent f995ba3df7
Exists in master

RC-FROM-MSG continue if rule is not valid

Showing 1 changed file with 8 additions and 0 deletions Side-by-side Diff

... ... @@ -24,6 +24,14 @@ function run(msg, rules) {
24 24 for(let i = 0; i < rules_count; i++) {
25 25 const rule = rules[i];
26 26  
  27 + if (typeof rule.pattern !== 'string') {
  28 + continue;
  29 + }
  30 +
  31 + if (typeof rule.rc !== 'string' && typeof rule.result !== 'string') {
  32 + continue;
  33 + }
  34 +
27 35 logOnDebug('RC-FROM-MSG: checking with rule: ' + JSON.stringify(rule));
28 36 const re = (typeof rule.flags === 'string') ? new RegExp(rule.pattern, rule.flags) : new RegExp(rule.pattern);
29 37 if (msg.search(re) > 0) {