From 19f727eed3575d4b65a0fc9bb40d856e0a39fbd6 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 21 Jul 2024 16:40:39 +0200 Subject: [PATCH] fix page crash on corrupted levelstring file --- history/templatetags/tags.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/history/templatetags/tags.py b/history/templatetags/tags.py index d23f9df..59755ce 100644 --- a/history/templatetags/tags.py +++ b/history/templatetags/tags.py @@ -11,6 +11,8 @@ @register.simple_tag def print_file_size(size): + if size is None: return "Corrupted" + size_KB = size / 1024 size_MB = size_KB / 1024 if size_MB > 1: return f"{size_MB:.2f} MB"