mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Fix crash when building notification state for messages without threads.
This commit is contained in:
committed by
Greyson Parrelli
parent
a157c1ae1d
commit
14565b0864
@@ -208,6 +208,8 @@ public class DatabaseFactory {
|
||||
synchronized (lock) {
|
||||
getInstance(context).databaseHelper.onUpgrade(database, database.getVersion(), -1);
|
||||
getInstance(context).databaseHelper.markCurrent(database);
|
||||
getInstance(context).sms.deleteAbandonedMessages();
|
||||
getInstance(context).mms.deleteAbandonedMessages();
|
||||
getInstance(context).mms.trimEntriesForExpiredMessages();
|
||||
getInstance(context).getRawDatabase().rawExecSQL("DROP TABLE IF EXISTS key_value");
|
||||
getInstance(context).getRawDatabase().rawExecSQL("DROP TABLE IF EXISTS megaphone");
|
||||
|
||||
@@ -202,8 +202,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper implements SignalDatab
|
||||
private static final int MESSAGE_DUPE_INDEX = 104;
|
||||
private static final int MESSAGE_LOG = 105;
|
||||
private static final int MESSAGE_LOG_2 = 106;
|
||||
private static final int ABANDONED_MESSAGE_CLEANUP = 107;
|
||||
|
||||
private static final int DATABASE_VERSION = 106;
|
||||
private static final int DATABASE_VERSION = 107;
|
||||
private static final String DATABASE_NAME = "signal.db";
|
||||
|
||||
private final Context context;
|
||||
@@ -1635,6 +1636,12 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper implements SignalDatab
|
||||
db.execSQL("CREATE TRIGGER msl_attachment_delete AFTER DELETE ON part BEGIN DELETE FROM msl_payload WHERE _id IN (SELECT payload_id FROM msl_message WHERE message_id = old.mid AND is_mms = 1); END");
|
||||
}
|
||||
|
||||
if (oldVersion < ABANDONED_MESSAGE_CLEANUP) {
|
||||
int smsDeleteCount = db.delete("sms", "thread_id NOT IN (SELECT _id FROM thread)", null);
|
||||
int mmsDeleteCount = db.delete("mms", "thread_id NOT IN (SELECT _id FROM thread)", null);
|
||||
Log.i(TAG, "Deleted " + smsDeleteCount + " sms and " + mmsDeleteCount + " mms");
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
|
||||
Reference in New Issue
Block a user