fix crash when config not present
This commit is contained in:
parent
246074a5bf
commit
911ec8d1e6
|
|
@ -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",
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue