ModelRelation/getOrFail: don't fail when 0 model where found

This commit is contained in:
Alice Gaudon 2020-07-28 15:02:40 +02:00
parent 37ed42b37d
commit fb1a09baf8

View File

@ -39,7 +39,7 @@ export default abstract class ModelRelation<S extends Model, O extends Model, R
}
public getOrFail(): R {
if (!this.cachedModels) throw new Error('Models were not fetched');
if (this.cachedModels === undefined) throw new Error('Models were not fetched');
return this.cachedModels;
}