Fix wallpaper migration getting stuck on malformed files.

Closes #13769
This commit is contained in:
Greyson Parrelli
2024-11-04 09:14:27 -05:00
parent bdd19f6b47
commit 3a5dc4e731
2 changed files with 28 additions and 5 deletions

View File

@@ -2061,7 +2061,18 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
* Migrates all recipients using [legacyUri] for their wallpaper to [newUri].
* Needed for an app migration.
*/
fun migrateWallpaperUri(legacyUri: Uri, newUri: Uri): Int {
fun migrateWallpaperUri(legacyUri: Uri, newUri: Uri?): Int {
if (newUri == null) {
return writableDatabase
.update(TABLE_NAME)
.values(
WALLPAPER to null,
WALLPAPER_URI to null
)
.where("$WALLPAPER_URI = ?", legacyUri)
.run()
}
val newWallpaper = ChatWallpaperFactory.create(newUri)
return writableDatabase