diff --git a/app/src/main/kotlin/org/libremail/mail/ImapConnectionCache.kt b/app/src/main/kotlin/org/libremail/mail/ImapConnectionCache.kt index 3b2446a..3dddea0 100644 --- a/app/src/main/kotlin/org/libremail/mail/ImapConnectionCache.kt +++ b/app/src/main/kotlin/org/libremail/mail/ImapConnectionCache.kt @@ -211,10 +211,12 @@ internal class ImapConnectionCache( // FolderClosedException/StoreClosedException are themselves MessagingException subtypes, so these // definite-drop checks must run before the MessagingException guard below — otherwise they'd fall // into it and get gated on a `.cause` they don't carry, instead of the unconditional `true` below. - if (error is FolderClosedException || error is StoreClosedException) return true - if (error is IOException || error is ConnectionException) return true - if (error !is MessagingException) return false - return error.cause is IOException || error.cause is ConnectionException + when { + error is FolderClosedException || error is StoreClosedException -> return true + error is IOException || error is ConnectionException -> return true + error !is MessagingException -> return false + else -> return error.cause is IOException || error.cause is ConnectionException + } } private companion object {