Fix KeyError in modelFieldDescriptions
on older Anki versions, where field descriptions aren't available
This commit is contained in:
parent
336dc8bb31
commit
ff4fb13428
@ -1075,7 +1075,12 @@ class AnkiConnect:
|
|||||||
if model is None:
|
if model is None:
|
||||||
raise Exception('model was not found: {}'.format(modelName))
|
raise Exception('model was not found: {}'.format(modelName))
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
return [field['description'] for field in model['flds']]
|
return [field['description'] for field in model['flds']]
|
||||||
|
except KeyError:
|
||||||
|
# older versions of Anki don't have field descriptions
|
||||||
|
return ['' for field in model['flds']]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@util.api()
|
@util.api()
|
||||||
|
Loading…
Reference in New Issue
Block a user