Fix bug caused when deleting a card just added and clicking History

This commit is contained in:
David Bailey 2017-01-09 10:55:30 +00:00
parent fb349a0a16
commit 620db69544

View File

@ -142,10 +142,14 @@ class AddCards(QDialog):
def onHistory(self):
m = QMenu(self)
for nid in self.history:
if self.mw.col.findNotes("nid:%s" % nid):
fields = self.mw.col.getNote(nid).fields
txt = stripHTMLMedia(",".join(fields))[:30]
a = m.addAction(_("Edit %s") % txt)
a.triggered.connect(lambda b, nid=nid: self.editHistory(nid))
else:
a = m.addAction(_("(Note deleted)"))
a.setEnabled(False)
runHook("AddCards.onHistory", self, m)
m.exec_(self.historyButton.mapToGlobal(QPoint(0,0)))