From 2210837a331946a5893866c137883530e7a2c104 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 17 Sep 2019 12:06:59 +0100 Subject: [PATCH] Handle failure to load post --- webinterface.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/webinterface.py b/webinterface.py index 59e6c8497..aa8ec1b50 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2137,8 +2137,14 @@ def htmlIndividualPost(translate: {}, \ postFilename=locatePost(baseDir,nickname,domain,postJsonObject['object']['inReplyTo']) if not postFilename: break - with open(postFilename, 'r') as fp: - postJsonObject=commentjson.load(fp) + loadedPost=False + try: + with open(postFilename, 'r') as fp: + postJsonObject=commentjson.load(fp) + loadedPost=True + except Exception as e: + print(e) + if loadedPost: postStr= \ individualPostAsHtml(iconsDir,translate,None, \ baseDir,session,wfRequest,personCache, \