Fix handling of undefined in FillCMDCache.

This commit is contained in:
Ben Blank
2021-09-15 12:12:40 -07:00
parent 74e7c64ca2
commit 53ed8fe167
5 changed files with 10 additions and 6 deletions

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]));
}
});
}