diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDataBase.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDataBase.kt index 8bf970ccd..de7f425f2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDataBase.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDataBase.kt @@ -22,9 +22,11 @@ abstract class GalleryDataBase : RoomDatabase() { fun getInstance(context: Context): GalleryDataBase { if (db == null) { synchronized(GalleryDataBase::class) { - db = Room.databaseBuilder(context.applicationContext, GalleryDataBase::class.java, "gallery.db") - .fallbackToDestructiveMigration() - .build() + if (db == null) { + db = Room.databaseBuilder(context.applicationContext, GalleryDataBase::class.java, "gallery.db") + .fallbackToDestructiveMigration() + .build() + } } } return db!!