Skip to content

Commit 35f6719

Browse files
authored
Merge pull request #2966 from Hammerspoon/fix-2912
Guard against an infinite Lua loop causing a C stack overflow when hs.loadSpoon() is called with an empty name. Closes #2912
2 parents 3b3f000 + 51aeb3e commit 35f6719

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

extensions/_coresetup/init.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ coroutine.applicationYield = hs.coroutineApplicationYield
297297
--- * If the Spoon provides documentation, it will be loaded by made available in hs.docs
298298
--- * To learn how to distribute your own code as a Spoon, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md
299299
hs.loadSpoon = function (name, global)
300+
if name == "" then
301+
hs.showError("hs.loadSpoon() called with no Spoon name")
302+
end
303+
300304
if _G["spoon"] == nil then
301305
_G["spoon"] = {}
302306
end

0 commit comments

Comments
 (0)