From fc2a53562efeafe0bccab6e16cdf3c51c49639eb Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Thu, 24 Oct 2013 18:43:55 -0700 Subject: [PATCH] Check undefined/null data --- lib/connectors/memory.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/connectors/memory.js b/lib/connectors/memory.js index c974a0b9..61aae072 100644 --- a/lib/connectors/memory.js +++ b/lib/connectors/memory.js @@ -119,8 +119,8 @@ Memory.prototype.fromDb = function(model, data) { var props = this._models[model].properties; for(var key in data) { var val = data[key]; - if (typeof val === 'undefined' || val === null) { - return; + if (val === undefined || val === null) { + continue; } if (props[key]) { switch(props[key].type.name) { @@ -216,7 +216,7 @@ function applyFilter(filter) { return function (obj) { var pass = true; keys.forEach(function (key) { - if (!test(filter.where[key], obj[key])) { + if (!test(filter.where[key], obj && obj[key])) { pass = false; } });