Skip to content

Commit

Permalink
Fix backup restore crash.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Mar 2, 2020
1 parent fd2a464 commit 543a4ee
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,14 @@ public static SQLiteDatabase getBackupDatabase(Context context) {
}

public static void upgradeRestored(Context context, SQLiteDatabase database){
getInstance(context).databaseHelper.onUpgrade(database, database.getVersion(), -1);
getInstance(context).databaseHelper.markCurrent(database);
getInstance(context).mms.trimEntriesForExpiredMessages();
synchronized (lock) {
getInstance(context).databaseHelper.onUpgrade(database, database.getVersion(), -1);
getInstance(context).databaseHelper.markCurrent(database);
getInstance(context).mms.trimEntriesForExpiredMessages();

instance.databaseHelper.close();
instance = null;
}
}

private DatabaseFactory(@NonNull Context context) {
Expand Down

0 comments on commit 543a4ee

Please sign in to comment.