From 6f90e2c4458ba67c3c5a76c96d9834aef7cffa04 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 6 May 2012 02:00:33 +0900 Subject: [PATCH] don't generate cards into invalid decks --- anki/collection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/anki/collection.py b/anki/collection.py index 36444bb77..0aa539292 100644 --- a/anki/collection.py +++ b/anki/collection.py @@ -324,10 +324,12 @@ crt=?, mod=?, scm=?, dty=?, usn=?, ls=?, conf=?""", did = t['did'] or did if self.decks.isDyn(did): did = 1 + # if the deck doesn't exist, use default instead + did = self.decks.get(did)['id'] # we'd like to use the same due# as sibling cards, but we # can't retrieve that quickly, so we give it a new id # instead - data.append((ts, nid, t['did'] or did, t['ord'], + data.append((ts, nid, did, t['ord'], now, usn, self.nextID("pos"))) ts += 1 # note any cards that need removing