mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
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
@ -2988,9 +2988,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessagingController.getInstance(getApplication()).sendMessage(mAccount, message, null);
|
MessagingController.getInstance(getApplication()).sendMessage(mAccount, message, null);
|
||||||
if (mDraftId != INVALID_DRAFT_ID) {
|
long draftId = mDraftId;
|
||||||
MessagingController.getInstance(getApplication()).deleteDraft(mAccount, mDraftId);
|
if (draftId != INVALID_DRAFT_ID) {
|
||||||
mDraftId = INVALID_DRAFT_ID;
|
mDraftId = INVALID_DRAFT_ID;
|
||||||
|
MessagingController.getInstance(getApplication()).deleteDraft(mAccount, draftId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -3311,9 +3311,11 @@ public class MessagingController implements Runnable {
|
|||||||
localFolder = localStore.getFolder(account.getDraftsFolderName());
|
localFolder = localStore.getFolder(account.getDraftsFolderName());
|
||||||
localFolder.open(OpenMode.READ_WRITE);
|
localFolder.open(OpenMode.READ_WRITE);
|
||||||
String uid = localFolder.getMessageUidById(id);
|
String uid = localFolder.getMessageUidById(id);
|
||||||
Message message = localFolder.getMessage(uid);
|
if (uid != null) {
|
||||||
if (message != null) {
|
Message message = localFolder.getMessage(uid);
|
||||||
deleteMessages(new Message[] { message }, null);
|
if (message != null) {
|
||||||
|
deleteMessages(new Message[] { message }, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
addErrorMessage(account, null, me);
|
addErrorMessage(account, null, me);
|
||||||
|
Loading…
Reference in New Issue
Block a user