aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-11-23 14:15:26 +0100
committerChristian Schneppe <christian@pix-art.de>2018-11-23 14:15:26 +0100
commit5b73ebe9d70b948966b628c6e79c76a8049d9cc5 (patch)
treed7825031d4b834e89e425c34fabebab27e57afa3 /src
parent9b833d033596ea16e954f8a86e1f09e352ccbf93 (diff)
catch cursor window allocation exception
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
index 8a6690c1b..d148ba0f9 100644
--- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
@@ -664,17 +664,23 @@ public class DatabaseBackend extends SQLiteOpenHelper {
db.insert(RESOLVER_RESULTS_TABLENAME, null, contentValues);
}
- public Resolver.Result findResolverResult(String domain) {
+ public synchronized Resolver.Result findResolverResult(String domain) {
SQLiteDatabase db = this.getReadableDatabase();
String where = Resolver.Result.DOMAIN + "=?";
String[] whereArgs = {domain};
final Cursor cursor = db.query(RESOLVER_RESULTS_TABLENAME, null, where, whereArgs, null, null, null);
Resolver.Result result = null;
if (cursor != null) {
- if (cursor.moveToFirst()) {
- result = Resolver.Result.fromCursor(cursor);
+ try {
+ if (cursor.moveToFirst()) {
+ result = Resolver.Result.fromCursor(cursor);
+ }
+ } catch (Exception e) {
+ Log.d(Config.LOGTAG, "unable to find cached resolver result in database " + e.getMessage());
+ return null;
+ } finally {
+ cursor.close();
}
- cursor.close();
}
return result;
}