aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-09-04 22:59:15 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-09-04 22:59:15 +0200
commitd2c475d50118cd606a37ceaa00d090f065bf357f (patch)
treef4ac448c8f0d01e4effcd91cf24833bf12301d28
parentad09d7dc4956f9c4fca02e68fc9e86f05c77d9d6 (diff)
don't crash when correcting waiting pgp encrypted messages
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 19d1186b..d0f2754c 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1124,10 +1124,18 @@ public class XmppConnectionService extends Service {
String decryptedBody = message.getBody();
message.setBody(pgpBody);
message.setEncryption(Message.ENCRYPTION_PGP);
- databaseBackend.createMessage(message);
- saveInDb = false;
- message.setBody(decryptedBody);
- message.setEncryption(Message.ENCRYPTION_DECRYPTED);
+ if (message.edited()) {
+ message.setBody(decryptedBody);
+ message.setEncryption(Message.ENCRYPTION_DECRYPTED);
+ databaseBackend.updateMessage(message, message.getEditedId());
+ updateConversationUi();
+ return;
+ } else {
+ databaseBackend.createMessage(message);
+ saveInDb = false;
+ message.setBody(decryptedBody);
+ message.setEncryption(Message.ENCRYPTION_DECRYPTED);
+ }
}
break;
case Message.ENCRYPTION_OTR: