Fix occasional crash on Android 7 direct reply

Fixes #6185
Closes #6322
//FREEBIE
This commit is contained in:
Max Muth 2017-03-01 13:18:37 +01:00 committed by Moxie Marlinspike
parent defb173ffe
commit 2c1a5aef1c

View File

@ -60,7 +60,6 @@ public class RemoteReplyReceiver extends MasterSecretBroadcastReceiver {
final long[] recipientIds = intent.getLongArrayExtra(RECIPIENT_IDS_EXTRA); final long[] recipientIds = intent.getLongArrayExtra(RECIPIENT_IDS_EXTRA);
final CharSequence responseText = remoteInput.getCharSequence(MessageNotifier.EXTRA_REMOTE_REPLY); final CharSequence responseText = remoteInput.getCharSequence(MessageNotifier.EXTRA_REMOTE_REPLY);
final Recipients recipients = RecipientFactory.getRecipientsForIds(context, recipientIds, false);
if (masterSecret != null && responseText != null) { if (masterSecret != null && responseText != null) {
new AsyncTask<Void, Void, Void>() { new AsyncTask<Void, Void, Void>() {
@ -72,6 +71,7 @@ public class RemoteReplyReceiver extends MasterSecretBroadcastReceiver {
int subscriptionId = preferences.isPresent() ? preferences.get().getDefaultSubscriptionId().or(-1) : -1; int subscriptionId = preferences.isPresent() ? preferences.get().getDefaultSubscriptionId().or(-1) : -1;
long expiresIn = preferences.isPresent() ? preferences.get().getExpireMessages() * 1000 : 0; long expiresIn = preferences.isPresent() ? preferences.get().getExpireMessages() * 1000 : 0;
Recipients recipients = RecipientFactory.getRecipientsForIds(context, recipientIds, false);
if (recipients.isGroupRecipient()) { if (recipients.isGroupRecipient()) {
OutgoingMediaMessage reply = new OutgoingMediaMessage(recipients, responseText.toString(), new LinkedList<Attachment>(), System.currentTimeMillis(), subscriptionId, expiresIn, 0); OutgoingMediaMessage reply = new OutgoingMediaMessage(recipients, responseText.toString(), new LinkedList<Attachment>(), System.currentTimeMillis(), subscriptionId, expiresIn, 0);
threadId = MessageSender.send(context, masterSecret, reply, -1, false); threadId = MessageSender.send(context, masterSecret, reply, -1, false);