mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-11 16:27:19 +10:00
gui_settings.py: Add error handling for invalid value
This commit is contained in:
@@ -158,7 +158,16 @@ class SettingsFrame(wx.Frame):
|
||||
if setting_info["type"] == "checkbox":
|
||||
# Add checkbox, and description underneath
|
||||
checkbox = wx.CheckBox(panel, label=setting, pos=(10 + width, 10 + height), size = (300,-1))
|
||||
checkbox.SetValue(setting_info["value"] if setting_info["value"] else False)
|
||||
|
||||
value = False
|
||||
if "value" in setting_info:
|
||||
try:
|
||||
value = bool(setting_info["value"])
|
||||
except ValueError:
|
||||
logging.error(f"Invalid value for {setting}, got {setting_info['value']} (type: {type(setting_info['value'])})")
|
||||
value = False
|
||||
|
||||
checkbox.SetValue(value)
|
||||
checkbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
|
||||
event = lambda event, warning=setting_info["warning"] if "warning" in setting_info else "", override=bool(setting_info["override_function"]) if "override_function" in setting_info else False: self.on_checkbox(event, warning, override)
|
||||
checkbox.Bind(wx.EVT_CHECKBOX, event)
|
||||
|
||||
Reference in New Issue
Block a user