Check undefined/null data

This commit is contained in:
Raymond Feng 2013-10-24 18:43:55 -07:00
parent f164ed6919
commit fc2a53562e
1 changed files with 3 additions and 3 deletions

View File

@ -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;
}
});