Fix handling of undefined in FillCMDCache.

This commit is contained in:
Ben Blank committed 2021-09-15 12:16:10 -07:00
1 parent 74e7c64ca2
commit 53ed8fe167
5 files changed
+10 -6

No files matched your search

+6 -2
View File
@@ -12,7 +12,11 @@ export default function FillCMDCache(caches) {
Object.keys(caches).forEach((name) => {
const exportName = name.replace(/^Cache/, '');
// Passing through JSON ensures that no references are retained.
window.CookieMonsterData.Cache[exportName] = JSON.parse(JSON.stringify(caches[name]));
if (typeof caches[name] === 'undefined') {
window.CookieMonsterData.Cache[exportName] = undefined;
} else {
// Passing through JSON ensures that no references are retained.
window.CookieMonsterData.Cache[exportName] = JSON.parse(JSON.stringify(caches[name]));
}
});
}