Fixed that sent date may is null
This commit is contained in:
parent
189b1b37ff
commit
2516328da8
|
@ -103,7 +103,7 @@ class MailReader(
|
|||
if (attachmentsWithEInvoice.isNotEmpty()) {
|
||||
return@mapNotNull MailWithInvoice(
|
||||
message.from.joinToString(), message.subject,
|
||||
map(message.sentDate), map(message.receivedDate), message.messageNumber,
|
||||
message.sentDate?.let { map(it) }, map(message.receivedDate), message.messageNumber,
|
||||
attachmentsWithEInvoice
|
||||
)
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ import java.time.ZoneId
|
|||
class MailWithInvoice(
|
||||
val sender: String,
|
||||
val subject: String,
|
||||
val sent: Instant,
|
||||
val sent: Instant?,
|
||||
val received: Instant,
|
||||
val messageNumber: Int,
|
||||
val attachmentsWithEInvoice: List<MailAttachmentWithEInvoice>
|
||||
) {
|
||||
override fun toString() = "${sent.atZone(ZoneId.systemDefault()).toLocalDate()} $sender: $subject, ${attachmentsWithEInvoice.size} invoice(s)"
|
||||
override fun toString() = "${(sent ?: received).atZone(ZoneId.systemDefault()).toLocalDate()} $sender: $subject, ${attachmentsWithEInvoice.size} invoice(s)"
|
||||
}
|
Loading…
Reference in New Issue