diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-10-01 00:01:07 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-10-01 00:01:07 +0800 |
commit | 13a837cd9648711a7b8ed5802a17f6ff479be395 (patch) | |
tree | 575e851da90265b615bcfedf11f33d225be29b15 /script | |
parent | a8007df95719639d8f7f03d3192d03b372a1d5c6 (diff) | |
download | lua-language-server-13a837cd9648711a7b8ed5802a17f6ff479be395.zip |
check nil
Diffstat (limited to 'script')
-rw-r--r-- | script/core/view/psi-view.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/script/core/view/psi-view.lua b/script/core/view/psi-view.lua index 86089dd4..86ed1403 100644 --- a/script/core/view/psi-view.lua +++ b/script/core/view/psi-view.lua @@ -21,7 +21,7 @@ local subString = require 'core.substring' ---@param state parser.state ---@return psi.view.node | nil local function toPsiNode(astNode, state) - if not astNode then + if not astNode or not astNode.start then return end @@ -63,7 +63,7 @@ local function collectPsi(astNode, state) end end) - if psiNode.children and psiNode.attr then + if psiNode.children and #psiNode.children > 0 and psiNode.attr then local range = psiNode.attr.range if range.start > psiNode.children[1].attr.range.start then range.start = psiNode.children[1].attr.range.start |