Merge pull request #127 from davidnewhall/dn2_fix_crash
protect against nil return values
This commit is contained in:
commit
a692b6f57e
|
|
@ -115,6 +115,9 @@ func (u *UnifiPoller) CollectMetrics() (*Metrics, error) {
|
|||
// This is where we can manipuate the returned data or make arbitrary decisions.
|
||||
// This function currently adds parent device names to client metrics.
|
||||
func (u *UnifiPoller) AugmentMetrics(metrics *Metrics) error {
|
||||
if metrics == nil || metrics.Devices == nil || metrics.Clients == nil {
|
||||
return fmt.Errorf("nil metrics, augment impossible")
|
||||
}
|
||||
devices := make(map[string]string)
|
||||
bssdIDs := make(map[string]string)
|
||||
for _, r := range metrics.UAPs {
|
||||
|
|
|
|||
Loading…
Reference in New Issue