Yutsuten / anki-lifedrain

Anki add-on that adds a life bar to anki while reviewing.
https://ankiweb.net/shared/info/715575551
GNU Affero General Public License v3.0
23 stars 2 forks source link

NoDeckSelectedError when selecting a deck #169

Closed Yutsuten closed 1 year ago

Yutsuten commented 1 year ago

Reported on AnkiWeb and #168

Anki version & Operating System: 2.1.65, 23.10 - Windows, Linux

When does the crash happens?

  1. Answer the card (show the answer but do not give the feedback)
  2. Press D and return to deck selection
  3. Press S to select a deck and BOOM

Traceback:

Anki 2.1.65 (aa9a734f) Python 3.9.15 Qt 5.15.2 PyQt 5.15.5
Platform: Windows-10-10.0.22621
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-11-05 15:23:03

Caught exception:
Traceback (most recent call last):
  File "aqt.taskman", line 122, in _on_closures_pending
  File "aqt.taskman", line 71, in <lambda>
  File "aqt.taskman", line 90, in wrapped_done
  File "aqt.operations", line 125, in wrapped_done
  File "aqt.deckbrowser", line 129, in <lambda>
  File "aqt.main", line 1224, in onOverview
  File "aqt.main", line 711, in moveToState
  File "_aqt.hooks", line 4757, in __call__
  File "C:\Users\xavie\AppData\Roaming\Anki2\addons21\715575551\main.py", line 50, in <lambda>
    gui_hooks.state_will_change.append(lambda *args: lifedrain.screen_change(args[0]))
  File "C:\Users\xavie\AppData\Roaming\Anki2\addons21\715575551\lifedrain.py", line 135, in screen_change
    self.deck_manager.answer(
  File "C:\Users\xavie\AppData\Roaming\Anki2\addons21\715575551\decorators.py", line 24, in _wrapper
    raise NoDeckSelectedError
715575551.exceptions.NoDeckSelectedError: Lifedrain failed to update life bar because there is no currently selected deck.""
Yutsuten commented 1 year ago

@edr1412 I fixed it here and I can't reproduce anymore. I uploaded it to AnkiWeb. Could you tell me if the newest version fixes it to you too?

edr1412 commented 1 year ago

Yes, I think the error popups are gone now. Thanks for the quick fix! @Yutsuten