From 1c90b59bb82a11a40d17b72e86b635c041c16d24 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Mon, 13 Apr 2015 08:57:20 -0700 Subject: [PATCH] Don't attempt send failure notifications for deleted messages. Fixes #2963 // FREEBIE --- src/org/thoughtcrime/securesms/database/ThreadDatabase.java | 3 ++- src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java index 94eab7a5a8..632543d338 100644 --- a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -22,6 +22,7 @@ import android.database.Cursor; import android.database.MergeCursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; +import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.Log; @@ -371,7 +372,7 @@ public class ThreadDatabase extends Database { } } - public Recipients getRecipientsForThreadId(long threadId) { + public @Nullable Recipients getRecipientsForThreadId(long threadId) { SQLiteDatabase db = databaseHelper.getReadableDatabase(); Cursor cursor = null; diff --git a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java index 212b0d03c9..779630f238 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java @@ -92,7 +92,9 @@ public class PushTextSendJob extends PushSendJob implements InjectableType { long threadId = DatabaseFactory.getSmsDatabase(context).getThreadIdForMessage(messageId); Recipients recipients = DatabaseFactory.getThreadDatabase(context).getRecipientsForThreadId(threadId); - MessageNotifier.notifyMessageDeliveryFailed(context, recipients, threadId); + if (threadId != -1 && recipients != null) { + MessageNotifier.notifyMessageDeliveryFailed(context, recipients, threadId); + } } private void deliver(MasterSecret masterSecret, SmsMessageRecord message)