mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
fix: empty candidate
This commit is contained in:
parent
0177086dcc
commit
0e4e5d3714
2 changed files with 6 additions and 1 deletions
|
|
@ -171,6 +171,9 @@ pub fn find_similar(typo: &str, candidates: &Vec<String>) -> Option<String> {
|
|||
let mut min_distance = 10;
|
||||
let mut min_distance_index = None;
|
||||
for (i, candidate) in candidates.iter().enumerate() {
|
||||
if candidate.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let distance = compare_string(typo, candidate);
|
||||
if distance < min_distance {
|
||||
min_distance = distance;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue