1
0
Fork 0

fixed crashing when trying to end a DB transaction, when there is no transaction (for example, when the storage becomes full)

This commit is contained in:
sspanak 2024-11-29 16:17:30 +02:00 committed by Dimo Karaivanov
parent 014c6923fb
commit f64588b850

View file

@ -88,16 +88,28 @@ public class SQLiteOpener extends SQLiteOpenHelper {
public void failTransaction() {
if (db != null) {
if (db == null) {
return;
}
if (db.inTransaction()) {
db.endTransaction();
} else {
Logger.e(LOG_TAG, "Cannot fail a transaction when not in transaction.");
}
}
public void finishTransaction() {
if (db != null) {
if (db == null) {
return;
}
if (db.inTransaction()) {
db.setTransactionSuccessful();
db.endTransaction();
} else {
Logger.e(LOG_TAG, "Cannot finish a transaction when not in transaction.");
}
}
}