Browse Source

Throw an error if trying to access a data variable with undefined em (#6268)

pull/6278/head
mohamed yahia 1 year ago
committed by GitHub
parent
commit
2055896922
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      packages/core/src/data_sources/model/DataVariable.ts

3
packages/core/src/data_sources/model/DataVariable.ts

@ -37,6 +37,9 @@ export default class DataVariable extends Model {
getDataValue() { getDataValue() {
const { path, defaultValue } = this.attributes; const { path, defaultValue } = this.attributes;
if (!this.em) {
throw new Error('EditorModel instance is not provided for a data variable.');
}
const val = this.em?.DataSources.getValue(path, defaultValue); const val = this.em?.DataSources.getValue(path, defaultValue);
return val; return val;

Loading…
Cancel
Save