From 06a69c25e67cc6f08abb311d2964e32a34361b34 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 8 Aug 2020 12:26:00 +1000 Subject: [PATCH] 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 --- rslib/src/dbcheck.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rslib/src/dbcheck.rs b/rslib/src/dbcheck.rs index 6b5d72dcda7..e099f4d2163 100644 --- a/rslib/src/dbcheck.rs +++ b/rslib/src/dbcheck.rs @@ -267,6 +267,9 @@ impl Collection { 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 let ctx = genctx.get_or_insert_with(|| CardGenContext::new(&nt, usn)); self.update_note_inner_generating_cards(&ctx, &mut note, false, norm)?;