Skip to content

Commit 1e2d93b

Browse files
committed
fix: handle None in serial port description/manufacturer during auto-detect
p.description and p.manufacturer can both be None on some platforms. Guard with 'or ""' to prevent TypeError on string concatenation. All checks pass: ruff check ✅, ruff format ✅, 358 tests ✅
1 parent ddfb5e1 commit 1e2d93b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

strands_robots/factory.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ def _auto_detect_mode(canonical: str) -> str:
6161
robot_ports = [
6262
p
6363
for p in ports
64-
if any(kw in (p.description + getattr(p, "manufacturer", "")).lower() for kw in servo_keywords)
65-
and not any(s in p.description.lower() for s in exclude)
64+
if any(
65+
kw in ((p.description or "") + (getattr(p, "manufacturer", None) or "")).lower()
66+
for kw in servo_keywords
67+
)
68+
and not any(s in (p.description or "").lower() for s in exclude)
6669
]
6770
if robot_ports:
6871
logger.info(

0 commit comments

Comments
 (0)