diff --git a/qt/aqt/addcards.py b/qt/aqt/addcards.py index efeacdb0c..68e1e97af 100644 --- a/qt/aqt/addcards.py +++ b/qt/aqt/addcards.py @@ -139,10 +139,9 @@ class AddCards(QMainWindow): # copy identical fields if field_name in old_fields: new[field_name] = old[field_name] - elif n < len(old.note_type()["flds"]): + elif n < len(old_fields): # set non-identical fields by field index - old_field_name = old.note_type()["flds"][n]["name"] - if old_field_name not in new_fields: + if old_fields[n] not in new_fields: new.fields[n] = old.fields[n] new.tags = old.tags diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 63c0b9b22..5e4b57960 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -354,7 +354,11 @@ noteEditorPromise.then(noteEditor => noteEditor.toolbar.toolbar.appendGroup({{ print("ignored late blur") return - self.note.fields[ord] = self.mungeHTML(txt) + try: + self.note.fields[ord] = self.mungeHTML(txt) + except IndexError: + print("ignored late blur after notetype change") + return if not self.addMode: self._save_current_note()