Description: Setting the string to empty when using the MaterialDatePicker's manual input mode throws an NPE
java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
at com.google.android.material.picker.SingleDateSelector$1.onValidDate(SingleDateSelector.java:103)
at com.google.android.material.picker.DateFormatTextWatcher.onTextChanged(DateFormatTextWatcher.java:63)
at android.widget.TextView.sendOnTextChanged(TextView.java:9754)
Expected behavior: It should handle the null value without any crash
Source code: Here's how I used it:
val datePicker = MaterialDatePicker.Builder
.datePicker()
.build()
datePicker.addOnPositiveButtonClickListener {
Log.d("Test", it.toString())
}
datePicker.show(requireFragmentManager(), "test")
Android API version: 29
Material Library version: 1.1.0-alpha10
Device: Emulator on API 28
We fixed this today. Thanks for the report.
Most helpful comment
We fixed this today. Thanks for the report.