diff --git a/packages/vchart/src/model/base-model.ts b/packages/vchart/src/model/base-model.ts index db2a5cd73..1469ce614 100644 --- a/packages/vchart/src/model/base-model.ts +++ b/packages/vchart/src/model/base-model.ts @@ -106,7 +106,7 @@ export abstract class BaseModel extends CompilableBase imp } protected get _theme() { - return this.getSpecInfo().theme; + return this.getSpecInfo()?.theme; } /** for layout diff */ diff --git a/packages/vutils-extension/src/utils/object.ts b/packages/vutils-extension/src/utils/object.ts index 42714eee3..91a297213 100644 --- a/packages/vutils-extension/src/utils/object.ts +++ b/packages/vutils-extension/src/utils/object.ts @@ -41,5 +41,8 @@ export const setProperty = (target: T, path: Array, value: a }; export const getProperty = (target: any, path: Array, defaultValue?: T): T => { + if (isNil(path)) { + return undefined; + } return get(target, path as string[], defaultValue) as T; };