npe check after reading image uri
This commit is contained in:
parent
d94c231a74
commit
6a15bc26b6
|
@ -400,7 +400,9 @@ public class FileBackend {
|
||||||
options.inSampleSize = calcSampleSize(image,Math.max(newHeight, newWidth));
|
options.inSampleSize = calcSampleSize(image,Math.max(newHeight, newWidth));
|
||||||
is = mXmppConnectionService.getContentResolver().openInputStream(image);
|
is = mXmppConnectionService.getContentResolver().openInputStream(image);
|
||||||
Bitmap source = BitmapFactory.decodeStream(is, null, options);
|
Bitmap source = BitmapFactory.decodeStream(is, null, options);
|
||||||
|
if (source == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
int sourceWidth = source.getWidth();
|
int sourceWidth = source.getWidth();
|
||||||
int sourceHeight = source.getHeight();
|
int sourceHeight = source.getHeight();
|
||||||
float xScale = (float) newWidth / sourceWidth;
|
float xScale = (float) newWidth / sourceWidth;
|
||||||
|
@ -418,8 +420,6 @@ public class FileBackend {
|
||||||
return dest;
|
return dest;
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException e) {
|
|
||||||
return null;
|
|
||||||
} finally {
|
} finally {
|
||||||
close(is);
|
close(is);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue