mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Fix possible IllegalArgumentException during a database migration.
This commit is contained in:
parent
94e8553b73
commit
b962751c96
@ -387,6 +387,7 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
|||||||
if (oldVersion < SELF_ATTACHMENT_CLEANUP) {
|
if (oldVersion < SELF_ATTACHMENT_CLEANUP) {
|
||||||
String localNumber = TextSecurePreferences.getLocalNumber(context);
|
String localNumber = TextSecurePreferences.getLocalNumber(context);
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(localNumber)) {
|
||||||
try (Cursor threadCursor = db.rawQuery("SELECT _id FROM thread WHERE recipient_ids = ?", new String[]{ localNumber })) {
|
try (Cursor threadCursor = db.rawQuery("SELECT _id FROM thread WHERE recipient_ids = ?", new String[]{ localNumber })) {
|
||||||
if (threadCursor != null && threadCursor.moveToFirst()) {
|
if (threadCursor != null && threadCursor.moveToFirst()) {
|
||||||
long threadId = threadCursor.getLong(0);
|
long threadId = threadCursor.getLong(0);
|
||||||
@ -399,6 +400,7 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user