Skip to content

Commit

Permalink
Removed an unwrap usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Lol3rrr committed Aug 25, 2023
1 parent 36875bb commit ef54f02
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub struct WarLogEntry {

#[derive(Debug, Deserialize)]
pub struct ClanInfo {
warLeague: serde_json::Value,
warLeague: Option<serde_json::Value>,
capitalLeague: serde_json::Value,
pub memberList: Vec<ClanMember>,
tag: ClanTag,
Expand Down Expand Up @@ -329,7 +329,13 @@ impl Client {

#[tracing::instrument(skip(client, clan_season_stats))]
pub async fn update_names(client: &Client, clan: &ClanTag, clan_season_stats: &mut ClanStorage) {
let info = client.clan_info(clan).await.unwrap();
let info = match client.clan_info(clan).await {
Ok(i) => i,
Err(e) => {
tracing::error!("Failed to load Clan Information {:?}", e);
return;
}
};

clan_season_stats.player_names.clear();
for member in info.memberList {
Expand Down

0 comments on commit ef54f02

Please sign in to comment.