fix crash when config not present

This commit is contained in:
davidnewhall2 2019-12-29 15:03:46 -08:00
parent 246074a5bf
commit 911ec8d1e6
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ type Config struct {
} }
func init() { func init() {
u := &InputUnifi{} u := &InputUnifi{Config: &Config{}}
poller.NewInput(&poller.InputPlugin{ poller.NewInput(&poller.InputPlugin{
Name: "unifi", Name: "unifi",

View File

@ -14,8 +14,8 @@ import (
// Initialize gets called one time when starting up. // Initialize gets called one time when starting up.
// Satisfies poller.Input interface. // Satisfies poller.Input interface.
func (u *InputUnifi) Initialize(l poller.Logger) error { func (u *InputUnifi) Initialize(l poller.Logger) error {
if u.Disable { if u.Config == nil || u.Disable {
l.Logf("UniFi input plugin disabled!") l.Logf("UniFi input plugin disabled or missing configuration!")
return nil return nil
} }