Skip to content

Commit

Permalink
fix: avoid crash on bad enum setting
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed Jun 21, 2022
1 parent b6c9437 commit 8ce0d4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gridplayer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def get(self, setting):
if issubclass(setting_type, Enum):
setting_value = self.settings.value(setting, _default_settings[setting])
if isinstance(setting_value, str):
return setting_type(setting_value)
try:
return setting_type(setting_value)
except ValueError:
return _default_settings[setting]

return self.settings.value(
setting, _default_settings[setting], type=setting_type
Expand Down

0 comments on commit 8ce0d4b

Please sign in to comment.