Skip to content

Commit 3a53abb

Browse files
committed
fix crash on OSX for boards without Manufacturer
1 parent 5c22ebc commit 3a53abb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

seriallist_darwin.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ func associateVidPidWithPort(ports []OsSerialPort) []OsSerialPort {
4747
if strings.Contains(element, "ID") || strings.Contains(element, "Manufacturer") {
4848
element = strings.TrimSpace(element)
4949
arr := strings.Split(element, ": ")
50-
cmdOutMap[arr[0]] = arr[1]
50+
if len(arr) > 1 {
51+
cmdOutMap[arr[0]] = arr[1]
52+
} else {
53+
cmdOutMap[arr[0]] = ""
54+
}
5155
}
5256
}
5357
ports[index].IdProduct = strings.Split(cmdOutMap["Product ID"], " ")[0]

0 commit comments

Comments
 (0)