diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-01-16 15:42:03 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-01-16 15:42:03 +0800 |
commit | d5a3c62c3f4a4fdbc0926a5e219e76254e6b8ff7 (patch) | |
tree | 5af5c7afe4dbd31fd428d405869a9e538b3e71ec /script/proto/proto.lua | |
parent | c44a0ca2c7e3b7b14cab51bcce0b966390d96254 (diff) | |
download | lua-language-server-d5a3c62c3f4a4fdbc0926a5e219e76254e6b8ff7.zip |
don't crash due to unknown response id
fix #1808
Diffstat (limited to 'script/proto/proto.lua')
-rw-r--r-- | script/proto/proto.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/script/proto/proto.lua b/script/proto/proto.lua index fda9fa01..7875b919 100644 --- a/script/proto/proto.lua +++ b/script/proto/proto.lua @@ -54,7 +54,10 @@ function m.response(id, res) log.error('Response id is nil!', inspect(res)) return end - assert(m.holdon[id]) + if not m.holdon[id] then + log.error('Unknown response id!', id) + return + end m.holdon[id] = nil local data = {} data.id = id @@ -67,7 +70,10 @@ function m.responseErr(id, code, message) log.error('Response id is nil!', inspect(message)) return end - assert(m.holdon[id]) + if not m.holdon[id] then + log.error('Unknown response id!', id) + return + end m.holdon[id] = nil m.send { id = id, |