Check undefined/null data
This commit is contained in:
parent
f164ed6919
commit
fc2a53562e
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue