From cf23360c4a51d98ae461d86b769ff91e4622c2d3 Mon Sep 17 00:00:00 2001 From: Bat Date: Wed, 11 Jul 2018 22:11:31 +0200 Subject: [PATCH] Avoid panics when encountering an invalid mention --- plume-models/src/mentions.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plume-models/src/mentions.rs b/plume-models/src/mentions.rs index ab2a9dbb..0d2e586c 100644 --- a/plume-models/src/mentions.rs +++ b/plume-models/src/mentions.rs @@ -63,8 +63,8 @@ impl Mention { } pub fn from_activity(conn: &PgConnection, ment: link::Mention, inside: i32, in_post: bool) -> Option { - let ap_url = ment.link_props.href_string().unwrap(); - let mentioned = User::find_by_ap_url(conn, ap_url).unwrap(); + let ap_url = ment.link_props.href_string().ok()?; + let mentioned = User::find_by_ap_url(conn, ap_url)?; if in_post { Post::get(conn, inside.clone().into()).map(|post| {