From e4fba94f2586e5b2ed41b2a57ae5d4b7adc469b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 4 Apr 2022 16:04:19 +0800 Subject: check nil --- script/parser/guide.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'script/parser/guide.lua') diff --git a/script/parser/guide.lua b/script/parser/guide.lua index eda85c97..e7b19bd3 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -803,6 +803,9 @@ function m.offsetToPosition(state, offset) end function m.getLineRange(state, row) + if not state.lines[row] then + return 0 + end local nextLineStart = state.lines[row + 1] or #state.lua for i = nextLineStart - 1, state.lines[row], -1 do local w = state.lua:sub(i, i) -- cgit v1.2.3