mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-02-16 20:10:37 +01:00
add another null check at obtaining the room database
This commit is contained in:
parent
6e898e43b8
commit
a1fdc2531d
@ -22,11 +22,13 @@ 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) {
|
||||||
|
if (db == null) {
|
||||||
db = Room.databaseBuilder(context.applicationContext, GalleryDataBase::class.java, "gallery.db")
|
db = Room.databaseBuilder(context.applicationContext, GalleryDataBase::class.java, "gallery.db")
|
||||||
.fallbackToDestructiveMigration()
|
.fallbackToDestructiveMigration()
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return db!!
|
return db!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user