summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-13 10:04:39 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-13 10:04:39 +0800
commitc27a44e9e77911efe5646715c2b3e42bb8409826 (patch)
tree6854301c5dae4844758e272ed1a2ac3fc54d221e
parentc3f0a9cfafe752fc28b39ec341e4479c3012e5ce (diff)
downloadlua-language-server-c27a44e9e77911efe5646715c2b3e42bb8409826.zip
判空
-rw-r--r--script-beta/core/hover/label.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/script-beta/core/hover/label.lua b/script-beta/core/hover/label.lua
index e0032979..3b1c5d0a 100644
--- a/script-beta/core/hover/label.lua
+++ b/script-beta/core/hover/label.lua
@@ -126,6 +126,9 @@ local function asNumber(source)
end
local uri = guide.getUri(source)
local text = files.getText(uri)
+ if not text then
+ return nil
+ end
local raw = text:sub(source.start, source.finish)
if not raw or not raw:find '[^%-%d%.]' then
return nil