diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 14:35:37 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 14:35:37 +0800 |
commit | 8d8c4359a855b02e663f8122fee8de34b06a9fd0 (patch) | |
tree | 9811147b439e0bd8fcb4e08f4f6a69a7476c5c6e /script | |
parent | e713e3f7f9d88ea4683b74749bed6e26fe222288 (diff) | |
download | lua-language-server-8d8c4359a855b02e663f8122fee8de34b06a9fd0.zip |
fix runtime errors
Diffstat (limited to 'script')
-rw-r--r-- | script/core/noder.lua | 5 | ||||
-rw-r--r-- | script/core/searcher.lua | 4 | ||||
-rw-r--r-- | script/provider/markdown.lua | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 40a0bb82..a63a1c25 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -313,7 +313,10 @@ local getKeyMap = util.switch() : call(function (source) local name = source[1] if source.typeGeneric then - return 'dg:' .. source.typeGeneric[name][1].start, nil + local first = source.typeGeneric[name][1] + if first then + return 'dg:' .. first.start, nil + end else return 'dn:' .. name, nil end diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 38124580..e75293f1 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -335,9 +335,9 @@ local genercCache = { local function flushGeneric() --清除来自泛型的临时对象 for _, closure in next, genercCache.closureCache do - local noders = getNoders(closure) - removeID(noders, getID(closure)) if closure then + local noders = getNoders(closure) + removeID(noders, getID(closure)) local values = closure.values for i = 1, #values do local value = values[i] diff --git a/script/provider/markdown.lua b/script/provider/markdown.lua index a8adbbef..c5765571 100644 --- a/script/provider/markdown.lua +++ b/script/provider/markdown.lua @@ -17,7 +17,11 @@ local function checkSplitLine(self) end function mt:add(language, text) - if not text or #text == 0 then + if not text then + return + end + text = tostring(text) + if #text == 0 then return end |