mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
ensure collection doesn't get stuck open if loading fails
This commit is contained in:
parent
f592672fa9
commit
0bb80329e8
1 changed files with 5 additions and 7 deletions
|
@ -482,13 +482,11 @@ close the profile or restart Anki."""
|
|||
tr(TR.ERRORS_UNABLE_OPEN_COLLECTION) + "\n" + traceback.format_exc()
|
||||
)
|
||||
# clean up open collection if possible
|
||||
if self.col:
|
||||
try:
|
||||
self.col.close(save=False, downgrade=False)
|
||||
except:
|
||||
pass
|
||||
self.col = None
|
||||
|
||||
try:
|
||||
self.backend.close_collection(False)
|
||||
except Exception as e:
|
||||
print("unable to close collection:", e)
|
||||
self.col = None
|
||||
# return to profile manager
|
||||
self.hide()
|
||||
self.showProfileManager()
|
||||
|
|
Loading…
Reference in a new issue