Skip to content

Commit da6c293

Browse files
fix: improve current profile retrieval logic in get_current_profile function
fix #35
1 parent 769af62 commit da6c293

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/blacklist.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ pub fn get_current_profile(game_path: &String) -> anyhow::Result<String> {
5656

5757
if blacklist.exists() {
5858
let data = fs::read_to_string(blacklist).unwrap();
59+
let profile_name = data.lines().next().map(|line| line.replace("# Profile: ", "")).unwrap_or("Default".to_string());
5960
let current_profile = profiles
6061
.iter()
61-
.find(|v| v.name == data.lines().next().unwrap().replace("# Profile: ", ""));
62+
.find(|v| v.name == profile_name);
6263

6364
if let Some(current_profile) = current_profile {
6465
Ok(current_profile.name.clone())

0 commit comments

Comments
 (0)