From 194c02ed16939c13a019c8a8535fca38b378242a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 16 Aug 2017 21:06:50 +1000 Subject: [PATCH] make sure we swallow the exception when closing otherwise the main window sticks around with no collection --- aqt/main.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/aqt/main.py b/aqt/main.py index 471212627..b91d2f9f6 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -338,15 +338,18 @@ Debug info: corrupt = self.col.db.scalar("pragma integrity_check") != "ok" except: corrupt = True + try: + self.col.close() + except: + corrupt = True + finally: + self.col = None if corrupt: showWarning(_("Your collection file appears to be corrupt. \ This can happen when the file is copied or moved while Anki is open, or \ -when the collection is stored on a network or cloud drive. Please see \ -the manual for information on how to restore from an automatic backup.")) - try: - self.col.close() - finally: - self.col = None +when the collection is stored on a network or cloud drive. If problems \ +persist after restarting your computer, please open an automatic backup \ +from the profile screen.")) if not corrupt and not self.restoringBackup: self.backup()