If the smallest sample we want to use still can't be loaded, throw an IOException for now to avoid crashing

This commit is contained in:
CSullivan102
2014-08-29 10:48:23 -04:00
parent 62f33d4d16
commit 6e3437bac2

View File

@@ -511,7 +511,11 @@ public class MultiImageChooserActivity extends Activity implements OnItemClickLi
bmp = this.tryToGetBitmap(file, options, rotate, true);
} catch (OutOfMemoryError e) {
options.inSampleSize = calculateNextSampleSize(options.inSampleSize);
bmp = this.tryToGetBitmap(file, options, rotate, false);
try {
bmp = this.tryToGetBitmap(file, options, rotate, false);
} catch (OutOfMemoryError e2) {
throw new IOException("Unable to load image into memory.");
}
}
} else {
try {
@@ -524,7 +528,11 @@ public class MultiImageChooserActivity extends Activity implements OnItemClickLi
} catch(OutOfMemoryError e2) {
options = new BitmapFactory.Options();
options.inSampleSize = 4;
bmp = this.tryToGetBitmap(file, options, rotate, false);
try {
bmp = this.tryToGetBitmap(file, options, rotate, false);
} catch (OutOfMemoryError e3) {
throw new IOException("Unable to load image into memory.");
}
}
}
}