Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit c56855f

Browse files
author
BuildTools
committed
handle empty hciconfig response to avoid panic
1 parent 07f31c6 commit c56855f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: hw/linux/hciconfig/hciconfig.go

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package hciconfig
22

33
import (
4+
"errors"
45
"strings"
56

67
"github.com/muka/go-bluetooth/hw/linux/cmd"
@@ -14,6 +15,10 @@ func GetAdapters() ([]HCIConfigResult, error) {
1415
return nil, err
1516
}
1617

18+
if len(out) == 0 {
19+
return nil, errors.New("hciconfig provided no response")
20+
}
21+
1722
list := []HCIConfigResult{}
1823
parts := strings.Split(out, "\nhci")
1924

0 commit comments

Comments
 (0)