mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
preview code shouldn't assume self.card is valid
This commit is contained in:
parent
380d59f775
commit
d24d485f06
1 changed files with 2 additions and 1 deletions
|
@ -1388,6 +1388,7 @@ where id in %s""" % ids2str(sf))
|
||||||
if not c or not self.singleCard:
|
if not c or not self.singleCard:
|
||||||
txt = _("(please select 1 card)")
|
txt = _("(please select 1 card)")
|
||||||
bodyclass = ""
|
bodyclass = ""
|
||||||
|
self._lastPreviewState = None
|
||||||
else:
|
else:
|
||||||
if self._previewBothSides:
|
if self._previewBothSides:
|
||||||
self._previewState = "answer"
|
self._previewState = "answer"
|
||||||
|
@ -1425,7 +1426,7 @@ where id in %s""" % ids2str(sf))
|
||||||
txt = mungeQA(self.col, txt)
|
txt = mungeQA(self.col, txt)
|
||||||
txt = runFilter("prepareQA", txt, c,
|
txt = runFilter("prepareQA", txt, c,
|
||||||
"preview"+self._previewState.capitalize())
|
"preview"+self._previewState.capitalize())
|
||||||
self._lastPreviewState = self._previewStateAndMod()
|
self._lastPreviewState = self._previewStateAndMod()
|
||||||
self._updatePreviewButtons()
|
self._updatePreviewButtons()
|
||||||
self._previewWeb.eval(
|
self._previewWeb.eval(
|
||||||
"{}({},'{}');".format(func, json.dumps(txt), bodyclass))
|
"{}({},'{}');".format(func, json.dumps(txt), bodyclass))
|
||||||
|
|
Loading…
Reference in a new issue