diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py
index c0c732ce..b64cefc6 100755
--- a/app/scodoc/html_sidebar.py
+++ b/app/scodoc/html_sidebar.py
@@ -88,8 +88,10 @@ def retreive_formsemestre_from_request() -> int:
if formsemestre_id is None:
return None # no current formsemestre
-
- return int(formsemestre_id)
+ try:
+ return int(formsemestre_id)
+ except ValueError:
+ return None # no current formsemestre
def sidebar_common():