Update bat.lua

Ensure that status is never nil. Closes #451
This commit is contained in:
Luca CPZ 2020-04-17 20:25:55 -05:00 committed by GitHub
parent 33c0e0c236
commit af125b324e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -136,7 +136,7 @@ local function factory(args)
-- "Full", "Unknown" or "Charging". When the laptop is not plugged in, -- "Full", "Unknown" or "Charging". When the laptop is not plugged in,
-- one or more of the batteries may be full, but only one battery -- one or more of the batteries may be full, but only one battery
-- discharging suffices to set global status to "Discharging". -- discharging suffices to set global status to "Discharging".
bat_now.status = bat_now.n_status[1] bat_now.status = bat_now.n_status[1] or "N/A"
for _,status in ipairs(bat_now.n_status) do for _,status in ipairs(bat_now.n_status) do
if status == "Discharging" or status == "Charging" then if status == "Discharging" or status == "Charging" then
bat_now.status = status bat_now.status = status