diff --git a/opencore_legacy_patcher/wx_gui/gui_settings.py b/opencore_legacy_patcher/wx_gui/gui_settings.py index 231c3426f..ae1e1e330 100644 --- a/opencore_legacy_patcher/wx_gui/gui_settings.py +++ b/opencore_legacy_patcher/wx_gui/gui_settings.py @@ -158,7 +158,16 @@ def _generate_elements(self, frame: wx.Frame = None) -> None: 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)