fix(battery): skip nil value batteries

This commit is contained in:
Jan De Dobbeleer 2021-09-18 20:05:42 +02:00 committed by Jan De Dobbeleer
parent 3f2b89f475
commit e1be81e658

View file

@ -48,6 +48,9 @@ func (b *batt) enabled() bool {
b.Battery = &battery.Battery{}
for _, bt := range batteries {
if bt == nil {
continue
}
b.Battery.Current += bt.Current
b.Battery.Full += bt.Full
b.Battery.State = b.mapMostLogicalState(b.Battery.State, bt.State)