Skip to content

Commit

Permalink
[MaterialCalendar] Fix NPE
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 502984835
  • Loading branch information
paulfthomas authored and raajkumars committed Jan 19, 2023
1 parent 4c31ab5 commit c484ea7
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,12 @@ public void onDraw(
}
int top = viewInRow.getTop() + calendarStyle.year.getTopInset();
int bottom = viewInRow.getBottom() - calendarStyle.year.getBottomInset();
int left = row == firstRow ? firstView.getLeft() + firstView.getWidth() / 2 : 0;
int left =
row == firstRow && firstView != null
? firstView.getLeft() + firstView.getWidth() / 2
: 0;
int right =
row == lastRow
row == lastRow && lastView != null
? lastView.getLeft() + lastView.getWidth() / 2
: recyclerView.getWidth();
canvas.drawRect(left, top, right, bottom, calendarStyle.rangeFill);
Expand Down

0 comments on commit c484ea7

Please sign in to comment.