Fix panic if interfaces does not have any mac address

This commit is contained in:
Hintay 2022-08-28 20:14:01 +08:00
parent d2aa528d0f
commit 97f00aeb8b
No known key found for this signature in database
GPG key ID: 120FC7FF121F2F2D

View file

@ -104,7 +104,7 @@ func JoinNetwork(cfg *config.ClientConfig, privateKey string) error {
// Find and set node MacAddress
if cfg.Node.MacAddress == "" {
macs, err := ncutils.GetMacAddr()
if err != nil {
if err != nil || len(macs) == 0 {
//if macaddress can't be found set to random string
cfg.Node.MacAddress = ncutils.MakeRandomString(18)
} else {