aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/cacheFactory.js
diff options
context:
space:
mode:
authorJeremy Tymes2012-11-13 07:33:26 -0500
committerIgor Minar2012-11-24 21:58:17 +0100
commit1eb9e22d450aa0b5c2221313e8c83dc5a47e3981 (patch)
tree26fef61ba5f7d751e85c5da8403e2be9ab4f6d1e /src/ng/cacheFactory.js
parentc0de8fb737d5d381e1ca5efc58c9ce5fcd860dd9 (diff)
downloadangular.js-1eb9e22d450aa0b5c2221313e8c83dc5a47e3981.tar.bz2
fix($cacheFactory): return undefined when removing non-existent entry
Instead of throwning an exception, remove should return undefined when cache entry to be removed doesn't exist. Closes #1497
Diffstat (limited to 'src/ng/cacheFactory.js')
-rw-r--r--src/ng/cacheFactory.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ng/cacheFactory.js b/src/ng/cacheFactory.js
index 850d48f2..2ff02a37 100644
--- a/src/ng/cacheFactory.js
+++ b/src/ng/cacheFactory.js
@@ -70,6 +70,8 @@ function $CacheFactoryProvider() {
remove: function(key) {
var lruEntry = lruHash[key];
+ if (!lruEntry) return;
+
if (lruEntry == freshEnd) freshEnd = lruEntry.p;
if (lruEntry == staleEnd) staleEnd = lruEntry.n;
link(lruEntry.n,lruEntry.p);