Skip to content

Commit

Permalink
Wrap _powerSources so an empty table doesn't break code (#3449)
Browse files Browse the repository at this point in the history
  • Loading branch information
asmagill committed Dec 10, 2023
1 parent f30eef2 commit f2af17b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extensions/battery/battery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
local module = require("hs.libbattery")
local fnutils = require("hs.fnutils")

local original_powerSources = module._powerSources
module._powerSources = function(...)
local temp = original_powerSources(...)
if type(temp) == "table" and #temp == 0 then
temp = { {} }
end
return temp
end

-- private variables and methods -----------------------------------------

local check_list = {
Expand Down

0 comments on commit f2af17b

Please sign in to comment.