From 1325f557bb2646cbaf00ed7d1de42b47cf59b895 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Mon, 21 Sep 2009 15:13:31 -0400 Subject: [PATCH] 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.) --- src/com/android/launcher2/WallpaperChooser.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher2/WallpaperChooser.java b/src/com/android/launcher2/WallpaperChooser.java index a5cce067a6..a74fa6a562 100644 --- a/src/com/android/launcher2/WallpaperChooser.java +++ b/src/com/android/launcher2/WallpaperChooser.java @@ -171,9 +171,17 @@ public class WallpaperChooser extends Activity implements AdapterView.OnItemSele } 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; } }