From af384d88f73f65f26d6b4bce751f815ba5fae00d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 17 Aug 2015 17:59:15 -0700 Subject: [PATCH] Handle potentially poisoned bitmap cache caused by truncated images from the server --- .../com/limelight/grid/assets/CachedAppAssetLoader.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/limelight/grid/assets/CachedAppAssetLoader.java b/app/src/main/java/com/limelight/grid/assets/CachedAppAssetLoader.java index 0dfdd8e8..fd991b77 100644 --- a/app/src/main/java/com/limelight/grid/assets/CachedAppAssetLoader.java +++ b/app/src/main/java/com/limelight/grid/assets/CachedAppAssetLoader.java @@ -105,7 +105,11 @@ public class CachedAppAssetLoader { // If there's a task associated with this load, we should return the bitmap if (task != null) { - return diskLoader.loadBitmapFromCache(tuple, (int) scalingDivider); + // If the cached bitmap is valid, return it. Otherwise, we'll try the load again + Bitmap bmp = diskLoader.loadBitmapFromCache(tuple, (int) scalingDivider); + if (bmp != null) { + return bmp; + } } else { // Otherwise it's a background load and we return nothing