From e4e5edbb3a9a53a7dffb4ab22ff8f6a0f69ce35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 15 Jul 2021 16:54:28 +0800 Subject: check nil --- script/workspace/workspace.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'script/workspace') diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 485fd5f4..0f7d8103 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -121,8 +121,10 @@ function m.getNativeMatcher() -- config.get 'workspace.library' for path in pairs(config.get 'Lua.workspace.library') do path = m.getAbsolutePath(path) - log.info('Ignore by library:', path) - pattern[#pattern+1] = path + if path then + log.info('Ignore by library:', path) + pattern[#pattern+1] = path + end end -- config.get 'workspace.ignoreDir' for path in pairs(config.get 'Lua.workspace.ignoreDir') do @@ -146,7 +148,9 @@ function m.getLibraryMatchers() local librarys = {} for path in pairs(config.get 'Lua.workspace.library') do path = m.getAbsolutePath(path) - librarys[m.normalize(path)] = true + if path then + librarys[m.normalize(path)] = true + end end if library.metaPath then librarys[m.normalize(library.metaPath)] = true @@ -449,6 +453,9 @@ function m.findUrisByRequirePath(path) end function m.normalize(path) + if not path then + return nil + end path = path:gsub('%$%{(.-)%}', function (key) if key == '3rd' then return (ROOT / 'meta' / '3rd'):string() -- cgit v1.2.3