diff --git a/invesalius/gui/preferences.py b/invesalius/gui/preferences.py index fa7e6eab2..37ba95cb5 100644 --- a/invesalius/gui/preferences.py +++ b/invesalius/gui/preferences.py @@ -92,7 +92,10 @@ def __bind_events(self): def OnOK(self, event): Publisher.sendMessage("Save Preferences") - self.EndModal(wx.ID_OK) + try: + self.EndModal(wx.ID_OK) + except wx._core.wxAssertionError: + self.Destroy() def OnCharHook(self, event): if event.GetKeyCode() == wx.WXK_ESCAPE: