aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-14 18:26:45 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-14 18:26:45 +0200
commit031b739af8122e0c6a2926c3f9db78e207560f64 (patch)
treec444c45a64bf2fa397ae586b498bbc43df8829b0 /src
parente98460771bac4e2252556ea6cf483c93a1ecf176 (diff)
catch can't open database exception
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/persistance/DatabaseBackend.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java
index 0991dd2d..091c00bd 100644
--- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -11,6 +11,7 @@ import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.Roster;
import android.content.Context;
import android.database.Cursor;
+import android.database.sqlite.SQLiteCantOpenDatabaseException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
@@ -231,10 +232,14 @@ public class DatabaseBackend extends SQLiteOpenHelper {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("select count(" + Account.UUID + ") from "
+ Account.TABLENAME + " where not options & (1 <<1)", null);
- cursor.moveToFirst();
- int count = cursor.getInt(0);
- cursor.close();
- return (count > 0);
+ try {
+ cursor.moveToFirst();
+ int count = cursor.getInt(0);
+ cursor.close();
+ return (count > 0);
+ } catch (SQLiteCantOpenDatabaseException e) {
+ return true; //better safe than sorry
+ }
}
@Override