kopia lustrzana https://github.com/ryukoposting/Signal-Android
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 // FREEBIEfork-5.53.8
rodzic
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();
|
||||
|
|
Ładowanie…
Reference in New Issue