Commit 2434747e authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Fix NPEs in DatePicker, TimePicker demos (#6509)

parent 5a9b8b77
...@@ -24,7 +24,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> { ...@@ -24,7 +24,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
firstDate: new DateTime(2015, 8), firstDate: new DateTime(2015, 8),
lastDate: new DateTime(2101) lastDate: new DateTime(2101)
); );
if (picked != _selectedDate) { if (picked != null && picked != _selectedDate) {
setState(() { setState(() {
_selectedDate = picked; _selectedDate = picked;
}); });
......
...@@ -21,7 +21,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> { ...@@ -21,7 +21,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
context: context, context: context,
initialTime: _selectedTime initialTime: _selectedTime
); );
if (picked != _selectedTime) { if (picked != null && picked != _selectedTime) {
setState(() { setState(() {
_selectedTime = picked; _selectedTime = picked;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment