Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix underline draw attempt being made on pages that might not exist. …

…Refs #50.
  • Loading branch information...
commit 8aab6c904e6fdc384ac15d6ce2100412843fdf3a 1 parent 9fe68ae
@JakeWharton JakeWharton authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 library/src/com/viewpagerindicator/TitlePageIndicator.java
View
7 library/src/com/viewpagerindicator/TitlePageIndicator.java
@@ -321,10 +321,11 @@ protected void onDraw(Canvas canvas) {
//Calculate views bounds
ArrayList<RectF> bounds = calculateAllBounds(mPaintText);
+ final int boundsSize = bounds.size();
//Make sure we're on a page that still exists
- if (mCurrentPage >= bounds.size()) {
- setCurrentItem(bounds.size()-1);
+ if (mCurrentPage >= boundsSize) {
+ setCurrentItem(boundsSize - 1);
}
final int countMinusOne = count - 1;
@@ -445,7 +446,7 @@ protected void onDraw(Canvas canvas) {
break;
case Underline:
- if (!currentSelected) {
+ if (!currentSelected || page >= boundsSize) {
break;
}
Please sign in to comment.
Something went wrong with that request. Please try again.