From eb4b238256ce283069591a6ad9802859b5cf3a5f Mon Sep 17 00:00:00 2001 From: nyyu Date: Mon, 10 May 2021 10:20:31 +0200 Subject: [PATCH] PB: fix null --- src/pb_data_source.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pb_data_source.rs b/src/pb_data_source.rs index abfc45b..728c435 100644 --- a/src/pb_data_source.rs +++ b/src/pb_data_source.rs @@ -15,8 +15,7 @@ struct ChampionResponse { #[derive(Deserialize, Debug)] struct Champion { - key: String, - name: String, + key: Option, } impl DataSource for PBDataSource { @@ -42,7 +41,9 @@ impl DataSource for PBDataSource { let data: ChampionResponse = serde_json::from_str(&page).unwrap(); for champ in data.champions { - champs.insert(champ.key.parse::().unwrap(), vec!["ANY".to_owned()]); + if let Some(k) = champ.key { + champs.insert(k.parse::().unwrap(), vec!["ANY".to_owned()]); + } } champs