diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-15 15:40:28 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-15 15:40:28 +0800 |
commit | f65de4fabbe2b8b1a66a13661adc26f9b93f5d80 (patch) | |
tree | c477127bcb547e5dc2f3ec3958adf9ac4af49eaf /server | |
parent | 212360dd88275317c2aa63252538f9cdae1db3b7 (diff) | |
download | lua-language-server-f65de4fabbe2b8b1a66a13661adc26f9b93f5d80.zip |
判空
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/completion.lua | 3 | ||||
-rw-r--r-- | server/src/core/signature.lua | 3 | ||||
-rw-r--r-- | server/src/vm/local.lua | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index 5ceb916c..1fd0516f 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -373,6 +373,9 @@ local function searchCallArg(vm, source, word, callback, pos) end) local call = results[1] local func, args = call:bindCall() + if not func then + return + end local lib = func:getLib() if not lib then diff --git a/server/src/core/signature.lua b/server/src/core/signature.lua index cafe2799..3e551e38 100644 --- a/server/src/core/signature.lua +++ b/server/src/core/signature.lua @@ -48,6 +48,9 @@ end local function getHover(call, pos) local func, args = call:bindCall() + if not func then + return + end local select = getSelect(args, pos) local source = getFunctionSource(call) local object = source:get 'object' diff --git a/server/src/vm/local.lua b/server/src/vm/local.lua index 6ddaac03..8f9ee3e4 100644 --- a/server/src/vm/local.lua +++ b/server/src/vm/local.lua @@ -109,6 +109,9 @@ end function mt:shadow(old) if not old then + if not self._shadow then + return nil + end for i = #self._shadow, 1, -1 do local loc = self._shadow[i] if not loc:getSource() then |