Skip to content

Commit

Permalink
Check for objects with a truthy clause to avoid nulls, fixes #16158
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen S authored and kriszyp committed Apr 26, 2014
1 parent a0e7890 commit 9b974ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions store/Cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var Cache = function(masterStore, cachingStore, options){
add: function(object, directives){
return when(masterStore.add(object, directives), function(result){
// now put result in cache
cachingStore.add(object && typeof result == "object" ? result : object, directives);
cachingStore.add(result && typeof result == "object" ? result : object, directives);
return result; // the result from the add should be dictated by the masterStore and be unaffected by the cachingStore
});
},
Expand All @@ -40,7 +40,7 @@ var Cache = function(masterStore, cachingStore, options){
cachingStore.remove((directives && directives.id) || this.getIdentity(object));
return when(masterStore.put(object, directives), function(result){
// now put result in cache
cachingStore.put(object && typeof result == "object" ? result : object, directives);
cachingStore.put(result && typeof result == "object" ? result : object, directives);
return result; // the result from the put should be dictated by the masterStore and be unaffected by the cachingStore
});
},
Expand Down

0 comments on commit 9b974ae

Please sign in to comment.