Skip to content

Commit 97b42d6

Browse files
fixed empty data crash when indicator is shown #125 (#126)
1 parent 73ff64d commit 97b42d6

File tree

1 file changed

+6
-5
lines changed
  • lib/src/main/java/com/turingtechnologies/materialscrollbar

1 file changed

+6
-5
lines changed

lib/src/main/java/com/turingtechnologies/materialscrollbar/Indicator.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@
1919
import android.content.Context;
2020
import android.graphics.Typeface;
2121
import android.graphics.drawable.GradientDrawable;
22-
import androidx.annotation.ColorInt;
23-
import androidx.core.content.ContextCompat;
24-
import androidx.core.view.ViewCompat;
25-
import androidx.recyclerview.widget.RecyclerView;
2622
import android.util.Log;
2723
import android.util.TypedValue;
2824
import android.view.ViewGroup;
2925
import android.widget.RelativeLayout;
3026
import android.widget.TextView;
3127

28+
import androidx.annotation.ColorInt;
29+
import androidx.core.content.ContextCompat;
30+
import androidx.core.view.ViewCompat;
31+
import androidx.recyclerview.widget.RecyclerView;
32+
3233
/**
3334
* Devs should not normally need to extend this class. Just use {@link CustomIndicator} instead.
3435
* However, this is public to leave the option open.
@@ -139,7 +140,7 @@ void setText(int section) {
139140
return;
140141
}
141142
newText = getTextElement(section, adapter);
142-
} catch (ArrayIndexOutOfBoundsException e) {
143+
} catch (IndexOutOfBoundsException e) {
143144
newText = "Error";
144145
}
145146
if(!textView.getText().equals(newText)) {

0 commit comments

Comments
 (0)