From fd9dee05380b668530898c643b916891df7ec71b Mon Sep 17 00:00:00 2001 From: Abao Zhang Date: Fri, 26 Apr 2024 15:38:37 +0800 Subject: [PATCH] fix(base): Path.glob return nil when finished --- lua/pathlib/base.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/pathlib/base.lua b/lua/pathlib/base.lua index 1b2533c..a8d9b07 100644 --- a/lua/pathlib/base.lua +++ b/lua/pathlib/base.lua @@ -629,7 +629,9 @@ function Path:glob(pattern) local result, i = vim.fn.globpath(str, pattern, false, true), 0 ---@diagnostic disable-line return function() i = i + 1 - return self.new(result[i]) + if i <= #result then + return self.new(result[i]) + end end end