fix(model-builder): __data may be null. (#1415)

This error was swallowed by strong-remoting try/catch
in eachRemoteFunctionInObject()
This commit is contained in:
Samuel Reed 2017-09-26 15:37:51 -05:00 committed by Kevin Delisle
parent 7c196af109
commit 40e278ab96
1 changed files with 2 additions and 2 deletions

View File

@ -303,7 +303,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
Object.defineProperty(ModelClass.prototype, 'id', {
get: function() {
var idProp = ModelClass.definition.idNames()[0];
return this.__data[idProp];
return this.__data && this.__data[idProp];
},
configurable: true,
enumerable: false,
@ -317,7 +317,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
var idNames = ModelClass.definition.idNames();
for (var i = 0, p; i < idNames.length; i++) {
p = idNames[i];
compositeId[p] = this.__data[p];
compositeId[p] = this.__data && this.__data[p];
}
return compositeId;
},