From 9a27e44ff8a953b03491a322d20d47ecf777c37d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 29 Aug 2021 14:00:55 +1000 Subject: [PATCH] don't panic when invalid note id provided to change notetype https://forums.ankiweb.net/t/fatal-error-while-updating-deck/12743/2 --- rslib/src/notetype/notetypechange.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rslib/src/notetype/notetypechange.rs b/rslib/src/notetype/notetypechange.rs index b173af8d3..50cbf627a 100644 --- a/rslib/src/notetype/notetypechange.rs +++ b/rslib/src/notetype/notetypechange.rs @@ -254,7 +254,7 @@ impl Collection { let ctx = CardGenContext::new(¬etype, last_deck, usn); 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(); remap_fields(note.fields_mut(), new_fields); note.notetype_id = new_notetype_id;