Fixed: Return sensible value from Levenshtein when distance too large

This commit is contained in:
ta264 2022-02-06 14:20:20 +00:00
parent 2bfc50b59b
commit 000022a927

View file

@ -217,7 +217,7 @@ public static int GetDistance(char[] target, char[] pattern, int limit = 20)
if (distance > limit)
{
/* More than we wanted. Give up right away */
return int.MaxValue;
return Math.Max(target.Length, pattern.Length);
}
/*