Skip to content

Commit 6882b43

Browse files
authored
Refactor name retrieval with default value
Use get and unwrap_or_else for safer text retrieval.
1 parent c363df3 commit 6882b43

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/update/dimbreath/gi/texts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub async fn update(configs: &Configs, pool: &PgPool) -> anyhow::Result<()> {
8282
continue;
8383
}
8484

85-
let name = text_map[&achievement.name.to_string()].clone();
85+
let name = text_map.get(&achievement.name.to_string()).cloned().unwrap_or_else(|| "Unknown".to_string());
8686
let mut description = text_map[&achievement.description.to_string()].clone();
8787

8888
if description.contains("{param0}") {

0 commit comments

Comments
 (0)