Skip to content

Commit 4404dc3

Browse files
committed
Fix crash when converting Port to rpc struct
1 parent 59a7719 commit 4404dc3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arduino/discovery/discovery.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,16 @@ type Port struct {
6565

6666
// ToRPC converts Port into rpc.Port
6767
func (p *Port) ToRPC() *rpc.Port {
68+
props := p.Properties
69+
if props == nil {
70+
props = properties.NewMap()
71+
}
6872
return &rpc.Port{
6973
Address: p.Address,
7074
Label: p.AddressLabel,
7175
Protocol: p.Protocol,
7276
ProtocolLabel: p.ProtocolLabel,
73-
Properties: p.Properties.AsMap(),
77+
Properties: props.AsMap(),
7478
}
7579
}
7680

0 commit comments

Comments
 (0)