mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Fix possible username conflict in storage update.
This commit is contained in:
@@ -981,6 +981,14 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
|
||||
}
|
||||
}
|
||||
|
||||
if (update.new.username != null) {
|
||||
writableDatabase
|
||||
.update(TABLE_NAME)
|
||||
.values(USERNAME to null)
|
||||
.where("$USERNAME = ?", update.new.username!!)
|
||||
.run()
|
||||
}
|
||||
|
||||
val updateCount = writableDatabase.update(TABLE_NAME, values, "$STORAGE_SERVICE_ID = ?", arrayOf(Base64.encodeBytes(update.old.id.raw)))
|
||||
if (updateCount < 1) {
|
||||
throw AssertionError("Account update didn't match any rows!")
|
||||
|
||||
Reference in New Issue
Block a user