diff options
author | James Campos <james.r.campos@gmail.com> | 2020-07-12 01:49:41 -0700 |
---|---|---|
committer | James Campos <james.r.campos@gmail.com> | 2020-07-12 01:49:41 -0700 |
commit | 2637f03c3b59909da9eb1e5b9b73ff4f2b06cddd (patch) | |
tree | 05a2fcc7d24c606f6c688242043c0fce6de15660 /src/epub.rs | |
parent | d6ef41c047523532ec3c60a85869e534de844343 (diff) | |
download | bk-2637f03c3b59909da9eb1e5b9b73ff4f2b06cddd.tar.gz |
fix meta panic
Diffstat (limited to 'src/epub.rs')
-rw-r--r-- | src/epub.rs | 8 |
1 files 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() |