mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Handle the case the photo file is deleted when loading a bitmap
This commit is contained in:
@@ -67,6 +67,10 @@ public class BitmapLoader extends AsyncTask<Void, Void, Bitmap> {
|
||||
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(uri.getPath(), options);
|
||||
|
||||
if (options.outWidth == 0 || options.outHeight == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set imageWidth and imageHeight based on image rotation
|
||||
int rotation = getRotation();
|
||||
@@ -87,7 +91,10 @@ public class BitmapLoader extends AsyncTask<Void, Void, Bitmap> {
|
||||
options.inPurgeable = true;
|
||||
|
||||
Bitmap scaledBitmap = BitmapFactory.decodeFile(uri.getPath(), options);
|
||||
|
||||
if (scaledBitmap == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the final bitmap after rotating the scaled down image
|
||||
Bitmap bitmap;
|
||||
if (rotation == 0 && fitWithin) {
|
||||
|
||||
Reference in New Issue
Block a user