Skip to content

Commit

Permalink
fix(votes): handle potential None result on total_votes (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
chikof authored Nov 27, 2024
2 parents fa4323b + 90ce008 commit 31d6bfb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/controllers/bot/votes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pub async fn votes(app: AppState, Path(bot_id): Path<String>) -> AppResult<Json<
let total_votes: i64 = BotVote::belonging_to(&bot)
.select(sum_votes)
.get_result(&mut conn)
.await?;
.await
.unwrap_or(0);

Ok(Json(json!({
"bot_votes": votes,
Expand Down

0 comments on commit 31d6bfb

Please sign in to comment.