fixes NPE on issue #422

This commit is contained in:
Cody Lee
2022-12-20 20:53:48 -06:00
parent a0feffb4f8
commit 97b3a476f9
3 changed files with 20 additions and 4 deletions

View File

@@ -24,10 +24,14 @@ func (u *InfluxUnifi) batchUXG(r report, s *unifi.UXG) { // nolint: funlen
"serial": s.Serial,
"type": s.Type,
}
var gw *unifi.Gw = nil
if s.Stat != nil {
gw = s.Stat.Gw
}
fields := Combine(
u.batchUDMstorage(s.Storage),
u.batchUDMtemps(s.Temperatures),
u.batchUSGstats(s.SpeedtestStatus, s.Stat.Gw, s.Uplink),
u.batchUSGstats(s.SpeedtestStatus, gw, s.Uplink),
u.batchSysStats(s.SysStats, s.SystemStats),
map[string]any{
"source": s.SourceName,