avoid NPE when minDate or maxDate is null.