npe check after reading image uri

This commit is contained in:
Daniel Gultsch 2015-04-28 22:23:45 +02:00
parent d94c231a74
commit 6a15bc26b6

View file

@ -400,7 +400,9 @@ public class FileBackend {
options.inSampleSize = calcSampleSize(image,Math.max(newHeight, newWidth));
is = mXmppConnectionService.getContentResolver().openInputStream(image);
Bitmap source = BitmapFactory.decodeStream(is, null, options);
if (source == null) {
return null;
}
int sourceWidth = source.getWidth();
int sourceHeight = source.getHeight();
float xScale = (float) newWidth / sourceWidth;
@ -418,8 +420,6 @@ public class FileBackend {
return dest;
} catch (FileNotFoundException e) {
return null;
} catch (IOException e) {
return null;
} finally {
close(is);
}