summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/data/ImageCacheService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/data/ImageCacheService.java')
-rw-r--r--src/com/android/gallery3d/data/ImageCacheService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/data/ImageCacheService.java b/src/com/android/gallery3d/data/ImageCacheService.java
index 1c7cb8c5e..9d3a6251c 100644
--- a/src/com/android/gallery3d/data/ImageCacheService.java
+++ b/src/com/android/gallery3d/data/ImageCacheService.java
@@ -56,6 +56,8 @@ public class ImageCacheService {
* @return true if the image data is found; false if not found.
*/
public boolean getImageData(Path path, long timeModified, int type, BytesBuffer buffer) {
+ if (mCache == null) return false;
+
byte[] key = makeKey(path, timeModified, type);
long cacheKey = Utils.crc64Long(key);
try {
@@ -78,6 +80,8 @@ public class ImageCacheService {
}
public void putImageData(Path path, long timeModified, int type, byte[] value) {
+ if (mCache == null) return;
+
byte[] key = makeKey(path, timeModified, type);
long cacheKey = Utils.crc64Long(key);
ByteBuffer buffer = ByteBuffer.allocate(key.length + value.length);
@@ -93,6 +97,8 @@ public class ImageCacheService {
}
public void clearImageData(Path path, long timeModified, int type) {
+ if (mCache == null) return;
+
byte[] key = makeKey(path, timeModified, type);
long cacheKey = Utils.crc64Long(key);
synchronized (mCache) {