Fix panic when remote discovery fails and no controllers configured (fixes #953) (#957)

* Fix panic when remote discovery fails and no controllers are configured

Call setDefaults(&u.Default) before logController(&u.Default) when
len(u.Controllers) == 0 so HashPII, DropPII, etc. are initialized
and logController does not dereference nil pointers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: trigger CI re-run

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: use golangci-lint v2.9 for Go 1.26-compatible deps

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Brian Gates
2026-02-17 19:13:25 -05:00
committed by GitHub
parent eae3741120
commit 40e2a7703f
2 changed files with 5 additions and 1 deletions

View File

@@ -48,4 +48,6 @@ jobs:
uses: golangci/golangci-lint-action@v9
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v2.6
# v2.9 is built with Go 1.26 so it can type-check deps (e.g. golang.org/x/crypto, x/net) that include go1.26-only files.
version: v2.9
skip-cache: true

View File

@@ -74,6 +74,7 @@ func (u *InputUnifi) Initialize(l poller.Logger) error {
}
if len(u.Controllers) == 0 {
u.setDefaults(&u.Default)
u.Logf("No controllers configured. Polling dynamic controllers only! Defaults:")
u.logController(&u.Default)
}
@@ -108,6 +109,7 @@ func (u *InputUnifi) DebugInput() (bool, error) {
}
if len(u.Controllers) == 0 {
u.setDefaults(&u.Default)
u.Logf("No controllers configured. Polling dynamic controllers only! Defaults:")
u.logController(&u.Default)
}