aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-07-12 01:49:41 -0700
committerJames Campos <james.r.campos@gmail.com>2020-07-12 01:49:41 -0700
commit2637f03c3b59909da9eb1e5b9b73ff4f2b06cddd (patch)
tree05a2fcc7d24c606f6c688242043c0fce6de15660 /src
parentd6ef41c047523532ec3c60a85869e534de844343 (diff)
downloadbk-2637f03c3b59909da9eb1e5b9b73ff4f2b06cddd.tar.gz
fix meta panic
Diffstat (limited to 'src')
-rw-r--r--src/epub.rs8
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()