Skip to content

Commit 93f6d40

Browse files
authored
Handle missing names with default 'Unknown'
1 parent f7ff15d commit 93f6d40

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/update/dimbreath/gi/texts.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub async fn update(configs: &Configs, pool: &PgPool) -> anyhow::Result<()> {
9999

100100
info!("Starting {} avatars", language);
101101
for avatar in &configs.avatar_data {
102-
let name = text_map[&avatar.name.to_string()].clone();
102+
let name = text_map.get(&avatar.name.to_string()).cloned().unwrap_or_else(|| "Unknown".to_string());
103103

104104
let id = avatar.id;
105105

@@ -112,9 +112,7 @@ pub async fn update(configs: &Configs, pool: &PgPool) -> anyhow::Result<()> {
112112
for weapon in &configs.weapon_data {
113113
let id = weapon.id;
114114

115-
let Some(name) = text_map.get(&weapon.name.to_string()).cloned() else {
116-
continue;
117-
};
115+
let name = text_map.get(&weapon.name.to_string()).cloned().unwrap_or_else(|| "Unknown".to_string());
118116

119117
weapons_id.push(id);
120118
weapons_language.push(language);

0 commit comments

Comments
 (0)