mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
add another null check at obtaining the room database
This commit is contained in:
parent
6e898e43b8
commit
a1fdc2531d
1 changed files with 5 additions and 3 deletions
|
@ -22,9 +22,11 @@ abstract class GalleryDataBase : RoomDatabase() {
|
||||||
fun getInstance(context: Context): GalleryDataBase {
|
fun getInstance(context: Context): GalleryDataBase {
|
||||||
if (db == null) {
|
if (db == null) {
|
||||||
synchronized(GalleryDataBase::class) {
|
synchronized(GalleryDataBase::class) {
|
||||||
db = Room.databaseBuilder(context.applicationContext, GalleryDataBase::class.java, "gallery.db")
|
if (db == null) {
|
||||||
.fallbackToDestructiveMigration()
|
db = Room.databaseBuilder(context.applicationContext, GalleryDataBase::class.java, "gallery.db")
|
||||||
.build()
|
.fallbackToDestructiveMigration()
|
||||||
|
.build()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return db!!
|
return db!!
|
||||||
|
|
Loading…
Reference in a new issue