From 8fc65f467c6d903e222f8ac2577395a25de34560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sat, 9 Nov 2024 21:28:52 +0000 Subject: [PATCH] handle non-existent icons --- common/components.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/components.py b/common/components.py index f16e0ba..7aa47ef 100644 --- a/common/components.py +++ b/common/components.py @@ -128,7 +128,11 @@ def Icon( name: str, attributes: list[HTMLAttribute] = [], ): - return Component(template=f"cotton/icon/{name}.html", attributes=attributes) + try: + result = Component(template=f"cotton/icon/{name}.html", attributes=attributes) + except TemplateDoesNotExist: + result = Icon(name="unspecified", attributes=attributes) + return result def LinkedNameWithPlatformIcon(name: str, game_id: int, platform: str) -> SafeText: