Fix bug where API returns noteid even when no note is added

This commit is contained in:
derxe 2019-03-05 03:53:57 +01:00 committed by GitHub
parent 0db93be681
commit 600979e745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -725,7 +725,9 @@ class AnkiConnect:
collection = self.collection()
self.startEditing()
collection.addNote(ankiNote)
nCardsAdded = collection.addNote(ankiNote)
if nCardsAdded < 1:
raise Exception('The field values you have provided would make an empty question on all cards.')
collection.autosave()
self.stopEditing()