From 00437988c88e35afb07826dd0524e319f3438be7 Mon Sep 17 00:00:00 2001 From: sushuang Date: Thu, 26 Aug 2021 12:41:10 +0800 Subject: [PATCH] fix: add null condition. --- src/animation/morphTransitionHelper.ts | 2 +- src/animation/universalTransition.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/animation/morphTransitionHelper.ts b/src/animation/morphTransitionHelper.ts index 1b6aad2e18..6caafe39f4 100644 --- a/src/animation/morphTransitionHelper.ts +++ b/src/animation/morphTransitionHelper.ts @@ -126,7 +126,7 @@ export function applyMorphAnimation( } const updateAnimationCfg = getAnimationConfig('update', seriesModel, dataIndex); - if (!(updateAnimationCfg.duration > 0)) { + if (!(updateAnimationCfg && updateAnimationCfg.duration > 0)) { return; } const animationDelay = (seriesModel.getModel('universalTransition') as Model) diff --git a/src/animation/universalTransition.ts b/src/animation/universalTransition.ts index 9dc27e20c4..8678cfcc11 100644 --- a/src/animation/universalTransition.ts +++ b/src/animation/universalTransition.ts @@ -129,7 +129,7 @@ function stopAnimation(el: Element) { } function animateElementStyles(el: Element, dataIndex: number, seriesModel: SeriesModel) { const animationConfig = getAnimationConfig('update', seriesModel, dataIndex); - el.traverse(child => { + animationConfig && el.traverse(child => { if (child instanceof Displayable) { const oldStyle = getOldStyle(child); if (oldStyle) { @@ -412,7 +412,7 @@ function transitionBetween( const seriesModel = data.hostModel as SeriesModel; const view = seriesModel && api.getViewOfSeriesModel(seriesModel as SeriesModel); const animationCfg = getAnimationConfig('update', seriesModel, 0); // use 0 index. - if (view && seriesModel.isAnimationEnabled() && animationCfg.duration > 0) { + if (view && seriesModel.isAnimationEnabled() && animationCfg && animationCfg.duration > 0) { view.group.traverse(el => { if (el instanceof Path && !el.animators.length) { // We can't accept there still exists element that has no animation