From 99b27a9a554ea015e794c19133737dd630f412b2 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sun, 18 Nov 2018 22:23:25 +0100 Subject: [PATCH] improving caching stability --- frontend/app/gallery/cache.gallery.service.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/app/gallery/cache.gallery.service.ts b/frontend/app/gallery/cache.gallery.service.ts index 642e2880..9fd5715d 100644 --- a/frontend/app/gallery/cache.gallery.service.ts +++ b/frontend/app/gallery/cache.gallery.service.ts @@ -101,12 +101,15 @@ export class GalleryCacheService { if (Config.Client.Other.enableCache === false) { return null; } - const value = localStorage.getItem(GalleryCacheService.CONTENT_PREFIX + Utils.concatUrls(directoryName)); - if (value != null) { - const directory: DirectoryDTO = JSON.parse(value); + try { + const value = localStorage.getItem(GalleryCacheService.CONTENT_PREFIX + Utils.concatUrls(directoryName)); + if (value != null) { + const directory: DirectoryDTO = JSON.parse(value); - DirectoryDTO.addReferences(directory); - return directory; + DirectoryDTO.addReferences(directory); + return directory; + } + } catch (e) { } return null; }