diff --git a/frameworks/core/components/swiper/render_swiper.cpp b/frameworks/core/components/swiper/render_swiper.cpp index 5924aa87..60ad1b1f 100644 --- a/frameworks/core/components/swiper/render_swiper.cpp +++ b/frameworks/core/components/swiper/render_swiper.cpp @@ -189,7 +189,9 @@ void RenderSwiper::Update(const RefPtr& component) remoteMessageEvent_ = AceAsyncEvent&)>::Create( swiper->GetRemoteMessageEventId(), context_); RegisterChangeEndListener(COMPONENT_CHANGE_END_LISTENER_KEY, swiper->GetChangeEndListener()); - if (swiper && swiper_ && (*swiper == *swiper_) && currentIndex_ == static_cast(swiper->GetIndex())) { + auto lazyComponent = swiper->GetLazyForEachComponent(); + if (swiper && swiper_ && (*swiper == *swiper_) && + currentIndex_ == static_cast(swiper->GetIndex()) && lazyComponent) { LOGI("swiper not changed"); swiper_ = swiper; return; @@ -254,7 +256,6 @@ void RenderSwiper::Update(const RefPtr& component) showIndicator_ = swiper->IsShowIndicator(); lazyLoadCacheSize_ = swiper->GetCachedSize() * 2 + swiper->GetDisplayCount(); - auto lazyComponent = swiper->GetLazyForEachComponent(); UpdateItemCount(lazyComponent ? static_cast(lazyComponent->TotalCount()) : itemCount_); ClearItems(lazyComponent, static_cast(swiper->GetIndex()));