Do not attempt to draw overlay on null bitmap
This commit is contained in:
parent
3dceb9d3ad
commit
284861de65
|
@ -651,7 +651,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
SQLiteDatabase db = this.getReadableDatabase();
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
String where = Resolver.Result.DOMAIN + "=?";
|
String where = Resolver.Result.DOMAIN + "=?";
|
||||||
String[] whereArgs = {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;
|
Resolver.Result result = null;
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
|
|
|
@ -252,7 +252,7 @@ public class FileBackend {
|
||||||
drawOverlay(bitmap, paintOverlayBlack(bitmap) ? R.drawable.play_video_black : R.drawable.play_video_white, 0.75f);
|
drawOverlay(bitmap, paintOverlayBlack(bitmap) ? R.drawable.play_video_black : R.drawable.play_video_white, 0.75f);
|
||||||
} else {
|
} else {
|
||||||
bitmap = cropCenterSquare(attachment.getUri(), size);
|
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);
|
Bitmap withGifOverlay = bitmap.copy(Bitmap.Config.ARGB_8888, true);
|
||||||
drawOverlay(withGifOverlay, paintOverlayBlack(withGifOverlay) ? R.drawable.play_gif_black : R.drawable.play_gif_white, 1.0f);
|
drawOverlay(withGifOverlay, paintOverlayBlack(withGifOverlay) ? R.drawable.play_gif_black : R.drawable.play_gif_white, 1.0f);
|
||||||
bitmap.recycle();
|
bitmap.recycle();
|
||||||
|
@ -1030,6 +1030,7 @@ public class FileBackend {
|
||||||
return cropCenterSquare(input, size);
|
return cropCenterSquare(input, size);
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException | SecurityException e) {
|
} catch (FileNotFoundException | SecurityException e) {
|
||||||
|
Log.d(Config.LOGTAG,"unable to open file "+image.toString(), e);
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
close(is);
|
close(is);
|
||||||
|
|
Loading…
Reference in New Issue