Skip to content

Commit

Permalink
fix(linux): handle no address for network connection sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Nov 5, 2023
1 parent cdd2df3 commit 254ad19
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/linux/networkConnectionSensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,12 @@ func getAddr(ctx context.Context, ver int, path dbus.ObjectPath) (addr string, m
if err != nil {
return
}
a := variantToValue[[]map[string]dbus.Variant](v)
return variantToValue[string](a[0]["address"]), variantToValue[int](a[0]["prefix"])
if !v.Signature().Empty() {
a := variantToValue[[]map[string]dbus.Variant](v)
return variantToValue[string](a[0]["address"]), variantToValue[int](a[0]["prefix"])
} else {
return "", 0
}
}

func getActiveConnections(ctx context.Context, updateCh chan interface{}) {
Expand Down

0 comments on commit 254ad19

Please sign in to comment.