From 25c49d5e34a842ddbe0a7430c87ea46065468245 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 25 Aug 2015 11:12:10 +0200 Subject: [PATCH] catch some db query exceptions --- src/main/java/eu/siacs/conversations/utils/FileUtils.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/utils/FileUtils.java b/src/main/java/eu/siacs/conversations/utils/FileUtils.java index a13300d43..c29841112 100644 --- a/src/main/java/eu/siacs/conversations/utils/FileUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/FileUtils.java @@ -104,15 +104,17 @@ public class FileUtils { }; try { - cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, - null); + cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,null); if (cursor != null && cursor.moveToFirst()) { final int column_index = cursor.getColumnIndexOrThrow(column); return cursor.getString(column_index); } + } catch(Exception e) { + return null; } finally { - if (cursor != null) + if (cursor != null) { cursor.close(); + } } return null; }