diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-10-20 21:27:31 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-10-20 21:27:31 +0200 |
commit | 80ee9306fe77578d0e6fdbf314f3789d241d61b6 (patch) | |
tree | ff0c89f95cdd5b568dae915d55ccc0b6e6f4a31e /src/main/java/de/pixart/messenger | |
parent | 291c7976827afcb7a70e541b2355f738b6abf143 (diff) |
Do not attempt to draw overlay on null bitmap
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | 2 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java index 4cc5b7955..dac626718 100644 --- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java @@ -663,7 +663,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { SQLiteDatabase db = this.getReadableDatabase(); String where = Resolver.Result.DOMAIN + "=?"; String[] whereArgs = {domain}; - Cursor cursor = db.query(RESOLVER_RESULTS_TABLENAME, null, where, whereArgs, null, null, null); + final Cursor cursor = db.query(RESOLVER_RESULTS_TABLENAME, null, where, whereArgs, null, null, null); Resolver.Result result = null; if (cursor != null) { if (cursor.moveToFirst()) { diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 0333d24fd..765766b5f 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -862,6 +862,7 @@ public class FileBackend { return cropCenterSquare(input, size); } } catch (FileNotFoundException | SecurityException e) { + Log.d(Config.LOGTAG, "unable to open file " + image.toString(), e); return null; } finally { close(is); @@ -1101,7 +1102,7 @@ public class FileBackend { drawOverlay(bitmap, R.drawable.play_video, 0.75f); } else { bitmap = cropCenterSquare(attachment.getUri(), size); - if ("image/gif".equals(attachment.getMime())) { + if (bitmap != null && "image/gif".equals(attachment.getMime())) { Bitmap withGifOverlay = bitmap.copy(Bitmap.Config.ARGB_8888, true); drawOverlay(withGifOverlay, R.drawable.play_gif, 1.0f); bitmap.recycle(); |