OSDN Git Service

Fix NPE when getting app icons
authorMichael Jurka <mikejurka@google.com>
Wed, 3 Aug 2011 18:49:59 +0000 (11:49 -0700)
committerMichael Jurka <mikejurka@google.com>
Wed, 3 Aug 2011 18:50:21 +0000 (11:50 -0700)
Change-Id: I04c171424006d90321c707d124211f007159c774

src/com/android/launcher2/IconCache.java

index 20c5f34..04f97f3 100644 (file)
@@ -69,11 +69,14 @@ public class IconCache {
     }
 
     public Drawable getFullResIcon(Resources resources, int iconId) {
+        Drawable d;
         try {
-            return resources.getDrawableForDensity(iconId, mIconDpi);
+            d = resources.getDrawableForDensity(iconId, mIconDpi);
         } catch (Resources.NotFoundException e) {
-            return getFullResDefaultActivityIcon();
+            d = null;
         }
+
+        return (d != null) ? d : getFullResDefaultActivityIcon();
     }
 
     public Drawable getFullResIcon(ResolveInfo info, PackageManager packageManager) {