🐛 Don't try to use empty string as timezone

This commit is contained in:
Gina Häußge committed 2023-12-12 17:56:00 +01:00
1 parent b42bef66d0
commit 745984e022
1 file changed
+7 -6
@@ -62,12 +62,13 @@ class AchievementsPlugin(
import pytz
timezone = self._settings.get(["timezone"])
try:
self._tz = pytz.timezone(timezone)
except Exception:
self._logger.exception(
f"Cannot load timezone {timezone}, falling back to server timezone"
)
if timezone:
try:
self._tz = pytz.timezone(timezone)
except Exception:
self._logger.exception(
f"Cannot load timezone {timezone}, falling back to server timezone"
)
return datetime.datetime.now(tz=self._tz)
##~~ Additional permissions hook