Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Commit 31d6bfb

Browse files
authored
fix(votes): handle potential None result on total_votes (#122)
2 parents fa4323b + 90ce008 commit 31d6bfb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/controllers/bot/votes.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ pub async fn votes(app: AppState, Path(bot_id): Path<String>) -> AppResult<Json<
4040
let total_votes: i64 = BotVote::belonging_to(&bot)
4141
.select(sum_votes)
4242
.get_result(&mut conn)
43-
.await?;
43+
.await
44+
.unwrap_or(0);
4445

4546
Ok(Json(json!({
4647
"bot_votes": votes,

0 commit comments

Comments
 (0)