diff --git a/MyTracks/src/com/google/android/apps/mytracks/services/tasks/BitmapLoader.java b/MyTracks/src/com/google/android/apps/mytracks/services/tasks/BitmapLoader.java index 995b665a3..96f5cca32 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/services/tasks/BitmapLoader.java +++ b/MyTracks/src/com/google/android/apps/mytracks/services/tasks/BitmapLoader.java @@ -67,6 +67,10 @@ public class BitmapLoader extends AsyncTask { 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 { 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) {