fix: params_b crashes the whole ranking on a malformed parameter_count (#1550)

This commit is contained in:
Afonso Coutinho
2026-06-03 06:23:30 +01:00
committed by GitHub
parent 398892cced
commit f93755e7a4
2 changed files with 31 additions and 1 deletions
+7 -1
View File
@@ -123,7 +123,13 @@ def params_b(model):
pc = pc.strip().upper()
m = re.match(r"^([\d.]+)\s*([BKMGT]?)$", pc)
if m:
val = float(m.group(1))
try:
val = float(m.group(1))
except ValueError:
# Malformed count like "1.5.3B" — [\d.]+ matches but float()
# rejects it. One bad catalog row must not abort the whole
# ranking pass, so treat it as unknown size.
return 0.0
suffix = m.group(2)
if suffix == "B":
return val