Stop crashing on invalid wallpaper thumbnail images.
We still won't be able to show a thumbnail, of course, but now instead of
crashing the picker we leave an empty box and write out a helpful Log.e such
as:
09-21 15:11:45.624: ERROR/Launcher(1539): Error decoding thumbnail resId=2130837544 for wallpaper #14
(Related to http://b/2113687.)
diff --git a/src/com/android/launcher2/WallpaperChooser.java b/src/com/android/launcher2/WallpaperChooser.java
index a5cce06..a74fa6a 100644
--- a/src/com/android/launcher2/WallpaperChooser.java
+++ b/src/com/android/launcher2/WallpaperChooser.java
@@ -171,9 +171,17 @@
} else {
image = (ImageView) convertView;
}
-
- image.setImageResource(mThumbs.get(position));
- image.getDrawable().setDither(true);
+
+ int thumbRes = mThumbs.get(position);
+ image.setImageResource(thumbRes);
+ Drawable thumbDrawable = image.getDrawable();
+ if (thumbDrawable != null) {
+ thumbDrawable.setDither(true);
+ } else {
+ Log.e(Launcher.LOG_TAG, String.format(
+ "Error decoding thumbnail resId=%d for wallpaper #%d",
+ thumbRes, position));
+ }
return image;
}
}