Skip to content

Commit bba5d5b

Browse files
author
Dennis Braun
committed
Fix crash on empty integer config values (#11)
config.get() now returns default (or 0) when an INT_KEY contains an empty string, instead of crashing with ValueError. Fixes settings like mqtt_port or booked_download being saved as ''.
1 parent 97a0d62 commit bba5d5b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ def get(self, key, default=None):
175175
if key in self._file_config:
176176
val = self._file_config[key]
177177
if key in INT_KEYS and not isinstance(val, int):
178+
if val == "" or val is None:
179+
return default if default is not None else 0
178180
return int(val)
179181
if key in HASH_KEYS:
180182
# Return werkzeug hash as-is; legacy Fernet-encrypted values get decrypted

0 commit comments

Comments
 (0)