Skip to content

Commit 70ddf60

Browse files
committed
Fixed crash
1 parent a168251 commit 70ddf60

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

omegarecyclerviewlibs/src/main/java/com/omega_r/libs/omegarecyclerview/item_decoration/SpaceItemDecoration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ void getItemOffset(@NonNull Rect outRect, @NonNull RecyclerView parent,
2424
if (isShowBeginDivider() || countBeginEndPositions <= position) helper.setStart(outRect, space);
2525
if (isShowEndDivider() && position == itemCount - countBeginEndPositions) helper.setEnd(outRect, space);
2626

27-
if (position % countBeginEndPositions != 0 || isShowBeginDivider()) helper.setOtherStart(outRect, space);
28-
if (position / (countBeginEndPositions - 1) > 0 && isShowEndDivider()) helper.setOtherEnd(outRect, space);
29-
30-
27+
if (countBeginEndPositions > 1) {
28+
if (position % countBeginEndPositions != 0 || isShowBeginDivider()) helper.setOtherStart(outRect, space);
29+
if (position / (countBeginEndPositions - 1) > 0 && isShowEndDivider()) helper.setOtherEnd(outRect, space);
30+
}
3131
}
3232

3333
private int getCountBeginEndPositions(RecyclerView recyclerView) {

0 commit comments

Comments
 (0)