From 2637f03c3b59909da9eb1e5b9b73ff4f2b06cddd Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 12 Jul 2020 01:49:41 -0700 Subject: fix meta panic --- src/epub.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/epub.rs b/src/epub.rs index b523c06..b5510c8 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -79,11 +79,13 @@ impl Epub { meta_node .children() - .filter(|n| n.is_element() && n.tag_name().name() != "meta") + .filter(Node::is_element) .for_each(|n| { let name = n.tag_name().name(); - let text = n.text().unwrap(); - self.meta.push_str(&format!("{}: {}\n", name, text)); + let text = n.text(); + if text.is_some() && name != "meta" { + self.meta.push_str(&format!("{}: {}\n", name, text.unwrap())); + } }); manifest_node .children() -- cgit v1.2.3