From 7b0a07bf40e6a232b1c191b766831a8b7a451f7a Mon Sep 17 00:00:00 2001 From: Glutanimate Date: Tue, 7 Mar 2017 19:07:23 +0100 Subject: [PATCH] Don't try to suspend card if no note returned --- cloze_overlapper/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cloze_overlapper/main.py b/cloze_overlapper/main.py index 2993110..e719ff2 100644 --- a/cloze_overlapper/main.py +++ b/cloze_overlapper/main.py @@ -328,18 +328,18 @@ def myBurySiblings(self, card, _old): def onAddNote(self, note, _old): """Suspend full cloze card if option active""" - oldret = _old(self, note) - if not checkModel(note.model(), fields=False, notify=False): - return oldret + note = _old(self, note) + if not note or not checkModel(note.model(), fields=False, notify=False): + return note config = mw.col.conf["olcloze"] sched_conf = config.get("sched", None) if not sched_conf or not sched_conf[2]: - return oldret + return note maxfields = ClozeOverlapper.getMaxFields(note.model(), config["flds"]["tx"]) last = note.cards()[-1] if last.ord == maxfields: # is full cloze (ord starts at 0) mw.col.sched.suspendCards([last.id]) - return oldret + return note # Menus