Fix crash when MMS messages have no 'from' address.
parent
37147fb0a5
commit
de1c6cdd0c
|
@ -921,6 +921,8 @@ public class MmsDatabase extends MessagingDatabase {
|
|||
if (notification.getFrom() != null) {
|
||||
Recipient recipient = Recipient.external(context, Util.toIsoString(notification.getFrom().getTextString()));
|
||||
contentValues.put(RECIPIENT_ID, recipient.getId().serialize());
|
||||
} else {
|
||||
contentValues.put(RECIPIENT_ID, RecipientId.UNKNOWN.serialize());
|
||||
}
|
||||
|
||||
contentValues.put(MESSAGE_BOX, Types.BASE_INBOX_TYPE);
|
||||
|
|
|
@ -75,8 +75,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
|||
private static final int RECIPIENT_IDS = 24;
|
||||
private static final int RECIPIENT_SEARCH = 25;
|
||||
private static final int RECIPIENT_CLEANUP = 26;
|
||||
private static final int MMS_RECIPIENT_CLEANUP = 27;
|
||||
|
||||
private static final int DATABASE_VERSION = 26;
|
||||
private static final int DATABASE_VERSION = 27;
|
||||
private static final String DATABASE_NAME = "signal.db";
|
||||
|
||||
private final Context context;
|
||||
|
@ -514,6 +515,13 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
|||
RecipientIdCleanupHelper.execute(db);
|
||||
}
|
||||
|
||||
if (oldVersion < MMS_RECIPIENT_CLEANUP) {
|
||||
ContentValues values = new ContentValues(1);
|
||||
values.put("address", "-1");
|
||||
int count = db.update("mms", values, "address = ?", new String[] { "0" });
|
||||
Log.i(TAG, "MMS recipient cleanup updated " + count + " rows.");
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
|
|
Loading…
Reference in New Issue