diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-10-21 20:25:42 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-10-21 20:25:42 +0800 |
commit | f2ab967b3e4e0c44604bc4df921bdb2b379d6b42 (patch) | |
tree | e94faae8cff11e3bd37b72b5d221b5e6140f75f5 /script | |
parent | 9791565324f0376494600ee230da7cdcb42a3310 (diff) | |
download | lua-language-server-f2ab967b3e4e0c44604bc4df921bdb2b379d6b42.zip |
fix some runtime errors
Diffstat (limited to 'script')
-rw-r--r-- | script/config/loader.lua | 2 | ||||
-rw-r--r-- | script/files.lua | 2 | ||||
-rw-r--r-- | script/parser/newparser.lua | 2 | ||||
-rw-r--r-- | script/proto/converter.lua | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/script/config/loader.lua b/script/config/loader.lua index 5874601e..03fe9456 100644 --- a/script/config/loader.lua +++ b/script/config/loader.lua @@ -21,7 +21,7 @@ function m.loadRCConfig(filename) if not path then return end - local buf = util.loadFile(path) + local buf = util.loadFile(path) if not buf then return end diff --git a/script/files.lua b/script/files.lua index 1de18a41..b367f09c 100644 --- a/script/files.lua +++ b/script/files.lua @@ -715,7 +715,7 @@ end function m.onWatch(ev, ...) for _, callback in ipairs(m.watchList) do - callback(ev, ...) + xpcall(callback, log.error, ev, ...) end end diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua index 23b8d07e..ca0bc66a 100644 --- a/script/parser/newparser.lua +++ b/script/parser/newparser.lua @@ -393,7 +393,7 @@ local function resolveLongString(finishMark) finishOffset = #Lua + 1 miss = true end - local stringResult = start and ssub(Lua, start, finishOffset - 1) + local stringResult = start and ssub(Lua, start, finishOffset - 1) or '' local lastLN = stringResult:find '[\r\n][^\r\n]*$' if lastLN then local result = stringResult diff --git a/script/proto/converter.lua b/script/proto/converter.lua index 2d3053b9..1c8e20fc 100644 --- a/script/proto/converter.lua +++ b/script/proto/converter.lua @@ -66,7 +66,7 @@ local function rawUnpackPosition(uri, position) if col > 0 then local state = files.getState(uri) local text = files.getText(uri) - if text then + if state and text then local lineOffset = state.lines[row] local textOffset = utf8.offset(text, col + 1, lineOffset) if textOffset and lineOffset then |