diff --git a/frameworks/core/components/swiper/render_swiper.cpp b/frameworks/core/components/swiper/render_swiper.cpp index 87f4f48a..23c7c933 100644 --- a/frameworks/core/components/swiper/render_swiper.cpp +++ b/frameworks/core/components/swiper/render_swiper.cpp @@ -178,7 +178,9 @@ void RenderSwiper::Update(const RefPtr& component) childrenArray_.clear(); MarkNeedLayout(); - + if (currentIndex_ >= itemCount_) { + currentIndex_ = itemCount_ > 0 ? itemCount_ - 1 : 0; + } if (itemCount_ < LEAST_SLIDE_ITEM_COUNT) { LOGD("swiper item is less than least slide count"); return;