Add extra transaction protections.

This commit is contained in:
Greyson Parrelli 2024-09-12 14:44:09 -04:00 committed by Cody Henthorne
parent 0d37013481
commit 5c6644d1a1

View file

@ -17,10 +17,14 @@ inline fun <T : SupportSQLiteDatabase, R> T.withinTransaction(block: (T) -> R):
beginTransaction()
try {
val toReturn = block(this)
setTransactionSuccessful()
if (inTransaction()) {
setTransactionSuccessful()
}
return toReturn
} finally {
endTransaction()
if (inTransaction()) {
endTransaction()
}
}
}