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:
parent
014c6923fb
commit
f64588b850
1 changed files with 14 additions and 2 deletions
|
|
@ -88,16 +88,28 @@ public class SQLiteOpener extends SQLiteOpenHelper {
|
||||||
|
|
||||||
|
|
||||||
public void failTransaction() {
|
public void failTransaction() {
|
||||||
if (db != null) {
|
if (db == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db.inTransaction()) {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
|
} else {
|
||||||
|
Logger.e(LOG_TAG, "Cannot fail a transaction when not in transaction.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void finishTransaction() {
|
public void finishTransaction() {
|
||||||
if (db != null) {
|
if (db == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db.inTransaction()) {
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
|
} else {
|
||||||
|
Logger.e(LOG_TAG, "Cannot finish a transaction when not in transaction.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue