don't crash when correcting waiting pgp encrypted messages

This commit is contained in:
Daniel Gultsch 2016-09-04 22:59:15 +02:00
parent ad09d7dc49
commit d2c475d501

View file

@ -1124,11 +1124,19 @@ public class XmppConnectionService extends Service {
String decryptedBody = message.getBody(); String decryptedBody = message.getBody();
message.setBody(pgpBody); message.setBody(pgpBody);
message.setEncryption(Message.ENCRYPTION_PGP); message.setEncryption(Message.ENCRYPTION_PGP);
if (message.edited()) {
message.setBody(decryptedBody);
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
databaseBackend.updateMessage(message, message.getEditedId());
updateConversationUi();
return;
} else {
databaseBackend.createMessage(message); databaseBackend.createMessage(message);
saveInDb = false; saveInDb = false;
message.setBody(decryptedBody); message.setBody(decryptedBody);
message.setEncryption(Message.ENCRYPTION_DECRYPTED); message.setEncryption(Message.ENCRYPTION_DECRYPTED);
} }
}
break; break;
case Message.ENCRYPTION_OTR: case Message.ENCRYPTION_OTR:
if (!conversation.hasValidOtrSession() && message.getCounterpart() != null) { if (!conversation.hasValidOtrSession() && message.getCounterpart() != null) {