!30 [Lightweight PR]: handle case: current index bigger than item count which after delete

Merge pull request !30 from kukixi/N/A
This commit is contained in:
openharmony_ci
2021-07-20 13:57:31 +00:00
committed by Gitee
@@ -178,7 +178,9 @@ void RenderSwiper::Update(const RefPtr<Component>& 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;