Catch OOM on decode image

pull/164/head
M66B 5 years ago
parent 8e9d6da937
commit 8be6738a7a

@ -504,6 +504,15 @@ class ImageHelper {
}
static Bitmap decodeImage(File file, int scaleToPixels) {
try {
return decodeImage(file, scaleToPixels);
} catch (OutOfMemoryError ex) {
Log.e(ex);
return null;
}
}
private static Bitmap _decodeImage(File file, int scaleToPixels) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(file.getAbsolutePath(), options);

Loading…
Cancel
Save