From cec679e059e6b60724f4e32c36e17151cf09a1bf Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 22 Sep 2012 12:46:48 +0900 Subject: [PATCH] if profile fails to load, revert back to profile manager --- aqt/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/aqt/main.py b/aqt/main.py index 0cd663a8f..0e948c853 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -249,7 +249,14 @@ To import into a password protected profile, please open the profile before atte def loadCollection(self): self.hideSchemaMsg = True - self.col = Collection(self.pm.collectionPath()) + try: + self.col = Collection(self.pm.collectionPath()) + except: + # move back to profile manager + showWarning("""\ +Your collection is corrupt. Please see the manual for \ +how to restore from a backup.""") + return self.unloadProfile() self.hideSchemaMsg = False self.progress.setupDB(self.col.db) self.moveToState("deckBrowser")