From f37f1e9ae9715f8e9229939df7d01862cc1a0ce0 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 21 Mar 2017 23:01:52 -0400 Subject: [PATCH] fix(image-loader): delete one file at once to maintain cache size --- src/providers/image-loader.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/providers/image-loader.ts b/src/providers/image-loader.ts index bd3806f..5e66193 100644 --- a/src/providers/image-loader.ts +++ b/src/providers/image-loader.ts @@ -349,6 +349,8 @@ export class ImageLoader { // grab the first item in index since it's the oldest one const file: IndexItem = this.cacheIndex.splice(0,1)[0]; + if (typeof file == 'undefined') return maintain(); + // delete the file then process next file if necessary this.file.removeFile(this.file.cacheDirectory + this.config.cacheDirectoryName, file.name) .then(() => next())