From 8213b6c08ff1c7c88780c2a66b89f26b15763852 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 21 Mar 2016 18:53:53 +0100 Subject: [PATCH] lib: Add missing setting of text content --- libimagnotes/src/note.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libimagnotes/src/note.rs b/libimagnotes/src/note.rs index bef74ed9..84c7542e 100644 --- a/libimagnotes/src/note.rs +++ b/libimagnotes/src/note.rs @@ -36,16 +36,23 @@ impl<'a> Note<'a> { { let mut entry = lockentry.deref_mut(); - let mut header = entry.get_header_mut(); - let setres = header.set("note", Value::Table(BTreeMap::new())); - if setres.is_err() { - return Err(NE::new(NEK::StoreWriteError, Some(Box::new(setres.err().unwrap())))); + + { + let mut header = entry.get_header_mut(); + let setres = header.set("note", Value::Table(BTreeMap::new())); + if setres.is_err() { + let kind = NEK::StoreWriteError; + return Err(NE::new(kind, Some(Box::new(setres.err().unwrap())))); + } + + let setres = header.set("note.name", Value::String(name)); + if setres.is_err() { + let kind = NEK::StoreWriteError; + return Err(NE::new(kind, Some(Box::new(setres.err().unwrap())))); + } } - let setres = header.set("note.name", Value::String(name)); - if setres.is_err() { - return Err(NE::new(NEK::StoreWriteError, Some(Box::new(setres.err().unwrap())))); - } + *entry.get_content_mut() = text; } lockentry