aboutsummaryrefslogtreecommitdiff
path: root/src/post.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/post.rs')
-rw-r--r--src/post.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/post.rs b/src/post.rs
index 97c49f1..20322b4 100644
--- a/src/post.rs
+++ b/src/post.rs
@@ -16,9 +16,12 @@ impl Post {
let posts_collection = posts.iter().map(Post::to_template_value).collect();
context.insert("has_posts".to_string(), Value::Bool(!posts.is_empty()));
+
+ // If you really reach over 18 quintillion posts, I guess you can send
+ // me a bug-request via e-mail.
context.insert(
"posts_length".to_string(),
- Value::Unsigned(posts.len().try_into().unwrap()),
+ Value::Unsigned(posts.len().try_into().unwrap_or(u64::MAX)),
);
context.insert("posts".to_string(), Value::Collection(posts_collection));
@@ -55,7 +58,7 @@ impl Post {
self.raw
.lines()
.next()
- .unwrap()
+ .unwrap_or("")
.replace('#', "")
.replace('&', "&")
.trim()