diff options
-rw-r--r-- | src/com/android/bitmap/DecodeTask.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/bitmap/DecodeTask.java b/src/com/android/bitmap/DecodeTask.java index 0f12bae..77b5982 100644 --- a/src/com/android/bitmap/DecodeTask.java +++ b/src/com/android/bitmap/DecodeTask.java @@ -440,8 +440,11 @@ public class DecodeTask extends AsyncTask<Void, Void, ReusableBitmap> { } } - // Put result in cache, regardless of null. The cache will handle null results. - mCache.put(mKey, result); + // Cancellations can't be guaranteed to be correct, so skip the cache + if (!isCancelled()) { + // Put result in cache, regardless of null. The cache will handle null results. + mCache.put(mKey, result); + } if (result != null) { result.acquireReference(); if (DEBUG) { |