From 2055896922039ae1bc7663ac15582cf82d663c5c Mon Sep 17 00:00:00 2001 From: mohamed yahia Date: Mon, 28 Oct 2024 09:36:31 +0300 Subject: [PATCH] Throw an error if trying to access a data variable with undefined em (#6268) --- packages/core/src/data_sources/model/DataVariable.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/src/data_sources/model/DataVariable.ts b/packages/core/src/data_sources/model/DataVariable.ts index a03e1d677..c84ef0b3c 100644 --- a/packages/core/src/data_sources/model/DataVariable.ts +++ b/packages/core/src/data_sources/model/DataVariable.ts @@ -37,6 +37,9 @@ export default class DataVariable extends Model { getDataValue() { 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); return val;