mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
If two recipient ids get canonicalized to the same thing, drop one
There's not a great way for me to know which of them is the "real" entry, which means that I could be deleting the wrong one. In the case of recipient "preferences," it's hopefully not a huge loss, and there aren't any other great options. Fixes #6838 // FREEBIE
This commit is contained in:
parent
8a5c89244a
commit
6ed549cfb2
@ -19,6 +19,7 @@ package org.thoughtcrime.securesms.database;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteConstraintException;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
@ -997,7 +998,13 @@ public class DatabaseFactory {
|
||||
|
||||
ContentValues values = new ContentValues(1);
|
||||
values.put("recipient_ids", Util.join(addresses, " "));
|
||||
db.update("recipient_preferences", values, "_id = ?", new String[] {String.valueOf(id)});
|
||||
|
||||
try {
|
||||
db.update("recipient_preferences", values, "_id = ?", new String[] {String.valueOf(id)});
|
||||
} catch (SQLiteConstraintException e) {
|
||||
Log.w(TAG, e);
|
||||
db.delete("recipient_preference", "_id = ?", new String[] {String.valueOf(id)});
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor != null) cursor.close();
|
||||
|
Loading…
x
Reference in New Issue
Block a user