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() {
u := &InputUnifi{}
u := &InputUnifi{Config: &Config{}}
poller.NewInput(&poller.InputPlugin{
Name: "unifi",

View File

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