aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-01 03:43:55 -0700
committerFuwn <[email protected]>2022-04-01 03:43:55 -0700
commit638a19e2ef38e2e48611942d44e8edb52a8c6e95 (patch)
tree2d194ee7660148d9543bdbf8f6449ce656bb2252 /src
parentformat: rust fmt (diff)
downloadlocus-638a19e2ef38e2e48611942d44e8edb52a8c6e95.tar.xz
locus-638a19e2ef38e2e48611942d44e8edb52a8c6e95.zip
fix(hits): trailing slash route hits
Diffstat (limited to 'src')
-rw-r--r--src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index be00227..bd58794 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -72,7 +72,13 @@ struct Main<'a> {
}
fn hits_from_route(route: &str) -> i32 {
- (*DATABASE.lock().unwrap()).get::<i32>(route).unwrap()
+ if let Ok(database) = DATABASE.lock() {
+ (*database)
+ .get::<i32>(if route.is_empty() { "/" } else { route })
+ .unwrap()
+ } else {
+ 0
+ }
}
#[windmark::main]