Skip to content

Commit 6614170

Browse files
committed
check nil
fix #2851
1 parent b9639f6 commit 6614170

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

script/vm/compiler.lua

+17-12
Original file line numberDiff line numberDiff line change
@@ -1171,22 +1171,27 @@ local function compileFunctionParam(func, source)
11711171
for _, set in ipairs(classDef:getSets(suri)) do
11721172
if set.type == 'doc.class' and set.extends then
11731173
for _, ext in ipairs(set.extends) do
1174+
if not ext[1] then
1175+
goto continue
1176+
end
11741177
local extClass = vm.getGlobal('type', ext[1])
1175-
if extClass then
1176-
vm.getClassFields(suri, extClass, key, function (field, isMark)
1177-
for n in vm.compileNode(field):eachObject() do
1178-
if n.type == 'function' and n.args[aindex] then
1179-
local argNode = vm.compileNode(n.args[aindex])
1180-
for an in argNode:eachObject() do
1181-
if an.type ~= 'doc.generic.name' then
1182-
vm.setNode(source, an)
1183-
found = true
1184-
end
1178+
if not extClass then
1179+
goto continue
1180+
end
1181+
vm.getClassFields(suri, extClass, key, function (field, isMark)
1182+
for n in vm.compileNode(field):eachObject() do
1183+
if n.type == 'function' and n.args[aindex] then
1184+
local argNode = vm.compileNode(n.args[aindex])
1185+
for an in argNode:eachObject() do
1186+
if an.type ~= 'doc.generic.name' then
1187+
vm.setNode(source, an)
1188+
found = true
11851189
end
11861190
end
11871191
end
1188-
end)
1189-
end
1192+
end
1193+
end)
1194+
::continue::
11901195
end
11911196
end
11921197
end

0 commit comments

Comments
 (0)