fix for NullPointerException in bitmap configs. Fixes AntennaPod/AntennaPod#887

This commit is contained in:
Tom Hennen 2015-06-17 21:27:31 -04:00
parent 3d102449bc
commit f29413f3b3
1 changed files with 12 additions and 1 deletions

View File

@ -266,6 +266,11 @@ public class PicassoProvider {
@Override
public Bitmap transform(Bitmap source) {
Bitmap result = fastblur(source, BLUR_RADIUS);
if (result == null) {
// just return the original
// for some reason we couldn't transform it.
return source;
}
source.recycle();
return result;
}
@ -305,8 +310,14 @@ public class PicassoProvider {
// the following line:
//
// Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com>
Bitmap.Config config = sentBitmap.getConfig();
if (config == null) {
// Sometimes the config can be null, in those cases
// we don't do a transform.
return null;
}
Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
Bitmap bitmap = sentBitmap.copy(config, true);
if (radius < 1) {
return (null);