From a65c20b3ad4c7f2a9409b8ad38f8fb63994c4f51 Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Sun, 26 Apr 2015 12:28:32 +0200 Subject: [PATCH] Avoid exception on exit Closing anki when the preferences dialog is open will cause an exception since self.mw.col in Preferences is not available anymore. Avoid the exception by checking self.mw.col again on accept(). --- aqt/preferences.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aqt/preferences.py b/aqt/preferences.py index 37453d9b1..68e62f741 100644 --- a/aqt/preferences.py +++ b/aqt/preferences.py @@ -29,6 +29,9 @@ class Preferences(QDialog): self.show() def accept(self): + # avoid exception if main window is already closed + if not self.mw.col: + return self.updateCollection() self.updateNetwork() self.updateBackup()