diff --git a/ankiqt/ui/sync.py b/ankiqt/ui/sync.py index 10e5635f1..b092684a8 100644 --- a/ankiqt/ui/sync.py +++ b/ankiqt/ui/sync.py @@ -88,6 +88,7 @@ class Sync(QThread): self.emit(SIGNAL("syncClockOff"), timediff) return # reconnect + self.deck = None try: self.deck = DeckStorage.Deck(self.parent.deckPath, backup=False) client = SyncClient(self.deck) @@ -158,7 +159,8 @@ class Sync(QThread): except Exception, e: self.ok = False #traceback.print_exc() - self.deck.close() + if self.deck: + self.deck.close() # cheap hack to ensure message is displayed err = `getattr(e, 'data', None) or e` self.setStatus(_("Syncing failed: %(a)s") % {