From 2e5853eabe8d53d767dd32c543563ab661001cac Mon Sep 17 00:00:00 2001 From: Ottatop Date: Sat, 24 Feb 2024 15:23:42 -0600 Subject: [PATCH] Return from batch if `requests` is empty Fixes a hang if you tried to close a window with the keybind with no windows open --- api/lua/pinnacle/util.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/lua/pinnacle/util.lua b/api/lua/pinnacle/util.lua index e05b814..661f919 100644 --- a/api/lua/pinnacle/util.lua +++ b/api/lua/pinnacle/util.lua @@ -58,6 +58,10 @@ local util = {} --- ---@return T[] responses The results of each request in the same order that they were in `requests`. function util.batch(requests) + if #requests == 0 then + return {} + end + local loop = require("cqueues").new() local responses = {}