don't panic when invalid note id provided to change notetype

https://forums.ankiweb.net/t/fatal-error-while-updating-deck/12743/2
This commit is contained in:
Damien Elmes 2021-08-29 14:00:55 +10:00
parent a4ff1152d3
commit 9a27e44ff8

View File

@ -254,7 +254,7 @@ impl Collection {
let ctx = CardGenContext::new(&notetype, last_deck, usn); let ctx = CardGenContext::new(&notetype, last_deck, usn);
for nid in note_ids { for nid in note_ids {
let mut note = self.storage.get_note(*nid)?.unwrap(); let mut note = self.storage.get_note(*nid)?.ok_or(AnkiError::NotFound)?;
let original = note.clone(); let original = note.clone();
remap_fields(note.fields_mut(), new_fields); remap_fields(note.fields_mut(), new_fields);
note.notetype_id = new_notetype_id; note.notetype_id = new_notetype_id;