Skip to content

Commit

Permalink
Renames instance variable name for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonis Lilis committed Dec 8, 2023
1 parent 4ce7666 commit 9a47820
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ class SavedInstanceDatabase(context: Context?) : SQLiteOpenHelper(context, DB_NA
private const val DB_NAME = "wpsavedinstance.db"
private const val DB_VERSION = 1

private var mSavedInstanceDb: SavedInstanceDatabase? = null
private var savedInstanceDb: SavedInstanceDatabase? = null
private val DB_LOCK = Any()

fun getDatabase(context: Context): SavedInstanceDatabase? {
if (mSavedInstanceDb == null) {
if (savedInstanceDb == null) {
synchronized(DB_LOCK) {
if (mSavedInstanceDb == null) {
mSavedInstanceDb = SavedInstanceDatabase(context.applicationContext)
if (savedInstanceDb == null) {
savedInstanceDb = SavedInstanceDatabase(context.applicationContext)
// this ensures that onOpen() is called with a writable database
// (open will fail if app calls getReadableDb() first)
mSavedInstanceDb?.writableDatabase
savedInstanceDb?.writableDatabase
}
}
}
return mSavedInstanceDb
return savedInstanceDb
}
}
}

0 comments on commit 9a47820

Please sign in to comment.