Skip to content

Commit

Permalink
Bug Fix #204
Browse files Browse the repository at this point in the history
  • Loading branch information
zhpanvip committed May 27, 2021
1 parent c765af3 commit 77350af
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
import com.zhpan.indicator.annotation.AIndicatorSlideMode;
import com.zhpan.indicator.annotation.AIndicatorStyle;
import com.zhpan.indicator.base.IIndicator;
import com.zhpan.indicator.enums.IndicatorOrientation;
import com.zhpan.indicator.option.IndicatorOptions;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static com.zhpan.bannerview.BaseBannerAdapter.MAX_VALUE;
import static com.zhpan.bannerview.constants.IndicatorGravity.CENTER;
import static com.zhpan.bannerview.constants.IndicatorGravity.END;
Expand Down Expand Up @@ -276,7 +275,7 @@ private void pageScrolled(int position, float positionOffset, int positionOffset
}

private void handlePosition() {
if (mBannerPagerAdapter.getListSize() > 1 && isAutoPlay()) {
if (mBannerPagerAdapter != null && mBannerPagerAdapter.getListSize() > 1 && isAutoPlay()) {
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1);
mHandler.postDelayed(mRunnable, getInterval());
}
Expand Down Expand Up @@ -461,7 +460,10 @@ protected void onRestoreInstanceState(Parcelable state) {
* @return BannerViewPager data set
*/
public List<T> getData() {
return mBannerPagerAdapter.getData();
if (mBannerPagerAdapter != null) {
return mBannerPagerAdapter.getData();
}
return Collections.emptyList();
}

/**
Expand Down

0 comments on commit 77350af

Please sign in to comment.