Skip to content

Commit c3e83f0

Browse files
committed
fix crash on on no results after filter
1 parent 1f0b019 commit c3e83f0

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lrcsync"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
edition = "2021"
55
description = "a simple tool to sync lrc files from lrclib.net"
66
license = "GPL-3.0"

src/main.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,20 @@ async fn main() {
284284
}).collect();
285285
}
286286
}
287+
288+
if canidates.len() > 0 {
287289

288-
println!("Searched lrc (found {}secs vs actual {}secs out of {} filtered results) for {}",canidates[0].duration,lrc_query.duration.unwrap_or(-1.0), canidates.len(), entry.path().display());
289-
// write to file with extension changed to .lrc
290-
// TODO: manual duration tolerance?
291-
match write_lrc_for_file(&entry, &canidates[0].syncedLyrics.as_ref().unwrap(), &config).await {
292-
Ok(_) => {},
293-
Err(err) => {
294-
println!("Error in saving lrc {}: {}",entry.path().display(), err);
290+
println!("Searched lrc (found {}secs vs actual {}secs out of {} filtered results) for {}",canidates[0].duration,lrc_query.duration.unwrap_or(-1.0), canidates.len(), entry.path().display());
291+
// write to file with extension changed to .lrc
292+
// TODO: manual duration tolerance?
293+
match write_lrc_for_file(&entry, &canidates[0].syncedLyrics.as_ref().unwrap(), &config).await {
294+
Ok(_) => {},
295+
Err(err) => {
296+
println!("Error in saving lrc {}: {}",entry.path().display(), err);
297+
}
295298
}
299+
} else {
300+
println!("Did not find lrc for (no results after filtering) {}",entry.path().display());
296301
}
297302
}
298303
},

0 commit comments

Comments
 (0)