Skip to content

Commit f7149d9

Browse files
committed
fix when no device connected, fa devices --json output null
1 parent 12b73a8 commit f7149d9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func listDevices() (ds []Device, err error) {
5757
}
5858
re := regexp.MustCompile(`(?m)^([^\s]+)\s+(device|offline|unauthorized)\s*$`)
5959
matches := re.FindAllStringSubmatch(string(output), -1)
60+
ds = make([]Device, 0, len(matches))
6061
for _, m := range matches {
6162
status := m[2]
6263
ds = append(ds, Device{

0 commit comments

Comments
 (0)