handle case: current index bigger than item count which after delete

This commit is contained in:
kukixi 2021-07-19 08:26:08 +00:00 committed by Gitee
parent a3b78c21bb
commit f31d9e17e6

View File

@ -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;