From 7ffc14e0fb3502b7cfd65cf20a3a451e7b5b0ad5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 24 Nov 2019 23:52:29 +0000 Subject: [PATCH] Check that index exists --- utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils.py b/utils.py index 65dd43d5c..65e4ff1e5 100644 --- a/utils.py +++ b/utils.py @@ -465,8 +465,10 @@ def removePostFromCache(postJsonObject: {},recentPostsCache: {}): if postId not in recentPostsCache['index']: return - del recentPostsCache['json'][postId] - del recentPostsCache['html'][postId] + if recentPostsCache['json'].get(postId): + del recentPostsCache['json'][postId] + if recentPostsCache['html'].get(postId): + del recentPostsCache['html'][postId] recentPostsCache['index'].remove(postId) def updateRecentPostsCache(recentPostsCache: {},maxRecentPosts: int, \