@@ -22,6 +22,10 @@ class MessagingControllerWrapper(
2222 return accountManager.getAccount(id.asRaw()) ? : error(" Account not found: $id " )
2323 }
2424
25+ private fun getAccountDtoOrNull (id : AccountId ): LegacyAccountDto ? {
26+ return accountManager.getAccount(id.asRaw())
27+ }
28+
2529 fun loadMoreMessages (id : AccountId , folderId : Long ) {
2630 val account = getAccountDtoOrThrow(id)
2731 messagingController.loadMoreMessages(account, folderId)
@@ -79,12 +83,12 @@ class MessagingControllerWrapper(
7983 }
8084
8185 fun isMoveCapable (id : AccountId ): Boolean {
82- val account = getAccountDtoOrThrow (id)
86+ val account = getAccountDtoOrNull (id) ? : return false
8387 return messagingController.isMoveCapable(account)
8488 }
8589
8690 fun isCopyCapable (id : AccountId ): Boolean {
87- val account = getAccountDtoOrThrow (id)
91+ val account = getAccountDtoOrNull (id) ? : return false
8892 return messagingController.isCopyCapable(account)
8993 }
9094
@@ -175,7 +179,7 @@ class MessagingControllerWrapper(
175179 notify : Boolean ,
176180 listener : MessagingListener ? ,
177181 ) {
178- val account = id?.let { getAccountDtoOrThrow (it) }
182+ val account = id?.let { getAccountDtoOrNull (it) }
179183
180184 messagingController.checkMail(
181185 account,
@@ -187,12 +191,12 @@ class MessagingControllerWrapper(
187191 }
188192
189193 fun supportsExpunge (id : AccountId ): Boolean {
190- val account = getAccountDtoOrThrow (id)
194+ val account = getAccountDtoOrNull (id) ? : return false
191195 return messagingController.supportsExpunge(account)
192196 }
193197
194198 fun isPushCapable (id : AccountId ): Boolean {
195- val account = getAccountDtoOrThrow (id)
199+ val account = getAccountDtoOrNull (id) ? : return false
196200 return messagingController.isPushCapable(account)
197201 }
198202
0 commit comments