Skip to content

Commit 42b9238

Browse files
Remove !!
1 parent 2abd930 commit 42b9238

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/src/main/java/com/infomaniak/mail/ui/MainViewModel.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,12 @@ class MainViewModel @Inject constructor(
346346
private fun updateExternalMailInfo(mailbox: Mailbox) = viewModelScope.launch(ioCoroutineContext) {
347347
SentryLog.d(TAG, "Force refresh External Mail info")
348348
with(ApiRepository.getExternalMailInfo(mailbox.hostingId, mailbox.mailboxName)) {
349-
if (isSuccess() && data != null) mailboxController.updateMailbox(mailbox.objectId) {
350-
it.externalMailFlagEnabled = data!!.externalMailFlagEnabled
351-
it.trustedDomains = data!!.trustedDomains.toRealmList()
349+
if (!isSuccess()) return@launch
350+
data?.let { externalMailInfo ->
351+
mailboxController.updateMailbox(mailbox.objectId) {
352+
it.externalMailFlagEnabled = externalMailInfo.externalMailFlagEnabled
353+
it.trustedDomains = externalMailInfo.trustedDomains.toRealmList()
354+
}
352355
}
353356
}
354357
}

0 commit comments

Comments
 (0)