Skip to content

Commit

Permalink
Check for null/undefined value during evaluation of lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
bbpennel committed May 18, 2021
1 parent d1d4b05 commit 2496517
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/lib/arrow/evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'use strict';

const isEmpty = require('./utils').isEmpty;
const logging = require('../../lib/logging');

function evaluateString(expression) {
return { type: 'string', value: expression.value };
Expand All @@ -22,9 +23,10 @@ function evaluateString(expression) {
function evaluateLookup(expression, context) {
let value = context;
for (let i = 0; i < expression.path.length; i++) {
if (expression.path[i] in value) {
if (value !== undefined && value !== null && expression.path[i] in value) {
value = value[expression.path[i]];
} else {
logging.debug("Unable to find value for " + expression.path[i] + " in context " + context);
value = undefined;
break;
}
Expand Down

0 comments on commit 2496517

Please sign in to comment.