mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 13:04:04 -08:00
fix(battery): skip nil value batteries
This commit is contained in:
parent
3f2b89f475
commit
e1be81e658
|
@ -48,6 +48,9 @@ func (b *batt) enabled() bool {
|
||||||
|
|
||||||
b.Battery = &battery.Battery{}
|
b.Battery = &battery.Battery{}
|
||||||
for _, bt := range batteries {
|
for _, bt := range batteries {
|
||||||
|
if bt == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
b.Battery.Current += bt.Current
|
b.Battery.Current += bt.Current
|
||||||
b.Battery.Full += bt.Full
|
b.Battery.Full += bt.Full
|
||||||
b.Battery.State = b.mapMostLogicalState(b.Battery.State, bt.State)
|
b.Battery.State = b.mapMostLogicalState(b.Battery.State, bt.State)
|
||||||
|
|
Loading…
Reference in a new issue