Fix null relation problem (#2319)
* Add null check for relation type map. For relations that are not explicitly defined in the schema, we need a null check here. * Making change to force rebuild. * Reverting change. * Adds test
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// A database adapter that works with data exported from the hosted
|
||||
// A database adapter that works with data exported from the hosted
|
||||
// Parse database.
|
||||
|
||||
import intersect from 'intersect';
|
||||
@@ -121,7 +121,7 @@ DatabaseController.prototype.loadSchema = function() {
|
||||
DatabaseController.prototype.redirectClassNameForKey = function(className, key) {
|
||||
return this.loadSchema().then((schema) => {
|
||||
var t = schema.getExpectedType(className, key);
|
||||
if (t.type == 'Relation') {
|
||||
if (t && t.type == 'Relation') {
|
||||
return t.targetClass;
|
||||
} else {
|
||||
return className;
|
||||
|
||||
Reference in New Issue
Block a user