AnkiHubSoftware / ankihub_addon

3 stars 0 forks source link

[BUILD-725] fix: TypeError in reviewer #1018

Closed RisingOrange closed 1 month ago

RisingOrange commented 1 month ago

Currently, when reviewing a note with a non-AnkiHub note type, this error occurs:

File "ankihub/gui/reviewer.py", line 126, in _add_ankihub_ai_js_to_reviewer_web_content
    ah_dids = {ah_did_of_note, ah_did_of_deck, *ah_dids_of_note_type} - {None}

TypeError: 'NoneType' object is not iterable

The reason is that the ankihub_dids_for_note_type function can return None.

To fix this, we can make it return an empty set instead of None when there are no AnkiHub deck ids for the note type.

Related issues

Proposed changes