fix assertion failure when recovering notetype

Notes need to have their notetype ID updated to reflect the
newly created notetype.

https://forums.ankiweb.net/t/anki-crashes-on-sync-study-export/1978
This commit is contained in:
Damien Elmes 2020-08-08 12:26:00 +10:00
parent 8363719994
commit 06a69c25e6

View file

@ -267,6 +267,9 @@ impl Collection {
out.field_count_mismatch += 1; out.field_count_mismatch += 1;
} }
// note type ID may have changed if we created a recovery notetype
note.ntid = nt.id;
// write note, updating tags and generating missing cards // write note, updating tags and generating missing cards
let ctx = genctx.get_or_insert_with(|| CardGenContext::new(&nt, usn)); let ctx = genctx.get_or_insert_with(|| CardGenContext::new(&nt, usn));
self.update_note_inner_generating_cards(&ctx, &mut note, false, norm)?; self.update_note_inner_generating_cards(&ctx, &mut note, false, norm)?;