Tasmota: tolerate missing power information in StatusSNS (#6050)
Some checks failed
Release / call-build-workflow (push) Has been cancelled
Release / Publish Docker :release (push) Has been cancelled
Release / Github & APT (push) Has been cancelled
Release / Demo (push) Has been cancelled
Release / Hassio Addon (push) Has been cancelled

Co-authored-by: Markus Thierolf <m.thierolf@googlemail.com>
This commit is contained in:
Markus Thierolf 2023-02-05 12:18:33 +01:00 • committed by GitHub
parent 338ec88cfe
commit b435855979
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,6 +96,9 @@ type StatusSNSResponse struct {
type Channels []float64
func (ch *Channels) Channel(channel int) (float64, error) {
if *ch == nil {
return 0, nil
}
if channel < 1 || channel > len(*ch) {
return 0, fmt.Errorf("invalid channel: %d", channel)
}