Skip to content

Commit

Permalink
[MaterialDatePicker] Improve inputs validation
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 489269023
  • Loading branch information
paulfthomas authored and drchen committed Nov 18, 2022
1 parent 1cdb371 commit 4046525
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Objects;

/**
* Used to limit the display range of the calendar and set an openAt month.
Expand Down Expand Up @@ -64,6 +65,9 @@ private CalendarConstraints(
@NonNull DateValidator validator,
@Nullable Month openAt,
int firstDayOfWeek) {
Objects.requireNonNull(start, "start cannot be null");
Objects.requireNonNull(end, "end cannot be null");
Objects.requireNonNull(validator, "validator cannot be null");
this.start = start;
this.end = end;
this.openAt = openAt;
Expand Down Expand Up @@ -370,6 +374,7 @@ public Builder setFirstDayOfWeek(int firstDayOfWeek) {
@NonNull
@CanIgnoreReturnValue
public Builder setValidator(@NonNull DateValidator validator) {
Objects.requireNonNull(validator, "validator cannot be null");
this.validator = validator;
return this;
}
Expand Down

0 comments on commit 4046525

Please sign in to comment.