now throw 404 error page if the final number doesn't exists

pull/1/head
kirbylife 2019-11-26 15:18:12 -06:00
parent b7bca3e455
commit a8094b5411
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ fn show_post(title: String) -> Template {
let mut context = get_context();
let title_splited: Vec<&str> = title.split('-').collect();
let id = title_splited.last().unwrap().parse().unwrap();
let id = title_splited.last().unwrap().parse().unwrap_or_else(|_| -1);
match get_post(id) {
Ok(mut post) => {