OSDN Git Service

Part of Bug 2163087 fix - NPE if the main thread is removing the reference.
authorCostin Manolache <costin@google.com>
Wed, 7 Oct 2009 00:28:39 +0000 (17:28 -0700)
committerCostin Manolache <costin@google.com>
Wed, 7 Oct 2009 00:34:45 +0000 (17:34 -0700)
src/com/android/contacts/ContactsListActivity.java

index 0dcfc53..0c929ba 100644 (file)
@@ -2101,8 +2101,13 @@ public class ContactsListActivity extends ListActivity implements
                             break;
                         }
 
-                        Bitmap photo = mBitmapCache.get(photoId).get();
+                        SoftReference<Bitmap> photoRef = mBitmapCache.get(photoId);
+                        if (photoRef == null) {
+                            break;
+                        }
+                        Bitmap photo = photoRef.get();
                         if (photo == null) {
+                            mBitmapCache.remove(photoId);
                             break;
                         }