Make sure draft id points to a valid message before deleting it
Avoids IllegalArgumentException in LocalStore.getMessage()
This commit is contained in:
parent
aae734c175
commit
5a8ddaa039
2 changed files with 8 additions and 5 deletions
|
@ -2988,9 +2988,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||
}
|
||||
|
||||
MessagingController.getInstance(getApplication()).sendMessage(mAccount, message, null);
|
||||
if (mDraftId != INVALID_DRAFT_ID) {
|
||||
MessagingController.getInstance(getApplication()).deleteDraft(mAccount, mDraftId);
|
||||
long draftId = mDraftId;
|
||||
if (draftId != INVALID_DRAFT_ID) {
|
||||
mDraftId = INVALID_DRAFT_ID;
|
||||
MessagingController.getInstance(getApplication()).deleteDraft(mAccount, draftId);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -3311,9 +3311,11 @@ public class MessagingController implements Runnable {
|
|||
localFolder = localStore.getFolder(account.getDraftsFolderName());
|
||||
localFolder.open(OpenMode.READ_WRITE);
|
||||
String uid = localFolder.getMessageUidById(id);
|
||||
Message message = localFolder.getMessage(uid);
|
||||
if (message != null) {
|
||||
deleteMessages(new Message[] { message }, null);
|
||||
if (uid != null) {
|
||||
Message message = localFolder.getMessage(uid);
|
||||
if (message != null) {
|
||||
deleteMessages(new Message[] { message }, null);
|
||||
}
|
||||
}
|
||||
} catch (MessagingException me) {
|
||||
addErrorMessage(account, null, me);
|
||||
|
|
Loading…
Reference in a new issue