Skip to content

Commit de262a7

Browse files
authored
fix(runtime): check if neighbour exists in nodes.List
maybe fix #242
1 parent 903d833 commit de262a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

runtime/nodes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (nodes *Nodes) NodeLinks(node *Node) (result []Link) {
117117
for sourceMAC, batadv := range neighbours.Batadv {
118118
for neighbourMAC, link := range batadv.Neighbours {
119119
if neighbourID := nodes.ifaceToNodeID[neighbourMAC]; neighbourID != "" {
120-
neighbour := nodes.List[neighbourID]
120+
neighbour, neighbourExists := nodes.List[neighbourID]
121121

122122
link := Link{
123123
SourceID: neighbours.NodeID,
@@ -127,7 +127,7 @@ func (nodes *Nodes) NodeLinks(node *Node) (result []Link) {
127127
TQ: float32(link.TQ) / 255.0,
128128
}
129129

130-
if neighbour.Nodeinfo != nil {
130+
if neighbourExists && neighbour.Nodeinfo != nil {
131131
link.TargetHostname = neighbour.Nodeinfo.Hostname
132132
}
133133
if node.Nodeinfo != nil {

0 commit comments

Comments
 (0)