don't crash in onCryptoOperationCancelled if no part is being processed
This commit is contained in:
parent
2279526e0d
commit
17647a6fac
1 changed files with 12 additions and 4 deletions
|
@ -554,8 +554,12 @@ public class MessageCryptoHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCryptoOperationCanceled() {
|
private void onCryptoOperationCanceled() {
|
||||||
|
// there are weird states that get us here when we're not actually processing any part. just skip in that case
|
||||||
|
// see https://github.com/k9mail/k-9/issues/1878
|
||||||
|
if (currentCryptoPart != null) {
|
||||||
CryptoResultAnnotation errorPart = CryptoResultAnnotation.createOpenPgpCanceledAnnotation();
|
CryptoResultAnnotation errorPart = CryptoResultAnnotation.createOpenPgpCanceledAnnotation();
|
||||||
addCryptoResultAnnotationToMessage(errorPart);
|
addCryptoResultAnnotationToMessage(errorPart);
|
||||||
|
}
|
||||||
onCryptoFinished();
|
onCryptoFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,8 +583,12 @@ public class MessageCryptoHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCryptoFinished() {
|
private void onCryptoFinished() {
|
||||||
currentCryptoPart = null;
|
if (currentCryptoPart != null) {
|
||||||
partsToDecryptOrVerify.removeFirst();
|
partsToDecryptOrVerify.removeFirst();
|
||||||
|
currentCryptoPart = null;
|
||||||
|
} else {
|
||||||
|
Log.e(K9.LOG_TAG, "Got to onCryptoFinished() with no part in processing!", new Throwable());
|
||||||
|
}
|
||||||
decryptOrVerifyNextPart();
|
decryptOrVerifyNextPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue