summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/guide.lua2
-rw-r--r--script/parser/newparser.lua3
2 files changed, 4 insertions, 1 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 4046cd69..b6cce241 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -763,7 +763,7 @@ end
function m.positionToOffsetByLines(lines, position)
local row, col = m.rowColOf(position)
- return lines[row] + col - 1
+ return (lines[row] or 1) + col - 1
end
--- 返回全文光标位置
diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua
index 747c4f5c..2322e4a1 100644
--- a/script/parser/newparser.lua
+++ b/script/parser/newparser.lua
@@ -909,6 +909,9 @@ local function parseShortString()
stringPool[stringIndex] = ssub(Lua, currentOffset, Tokens[Index] - 1)
currentOffset = Tokens[Index]
Index = Index + 2
+ if not Tokens[Index] then
+ goto CONTINUE
+ end
-- has space?
if Tokens[Index] - currentOffset > 1 then
pushError {