Skip to content

Commit 6f82c65

Browse files
committed
fix: add missing errs ~= nil checks to script/vm/type checkTableShape
1 parent 2da06ee commit 6f82c65

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

script/vm/type.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,11 @@ local function checkTableShape(parent, child, uri, mark, errs)
321321
if myKeys[key] then
322322
ok = vm.isSubType(uri, myKeys[key], nodeField, mark, errs)
323323
if ok == false then
324-
errs[#errs+1] = 'TYPE_ERROR_PARENT_ALL_DISMATCH' -- error display can be greatly improved
325-
errs[#errs+1] = myKeys[key]
326-
errs[#errs+1] = nodeField
324+
if errs then
325+
errs[#errs+1] = 'TYPE_ERROR_PARENT_ALL_DISMATCH' -- error display can be greatly improved
326+
errs[#errs+1] = myKeys[key]
327+
errs[#errs+1] = nodeField
328+
end
327329
failedCheck = true
328330
end
329331
elseif not nodeField:isNullable() then
@@ -337,7 +339,7 @@ local function checkTableShape(parent, child, uri, mark, errs)
337339
end
338340
::continue::
339341
end
340-
if #missedKeys > 0 then
342+
if errs and #missedKeys > 0 then
341343
errs[#errs+1] = 'DIAG_MISSING_FIELDS'
342344
errs[#errs+1] = parent
343345
errs[#errs+1] = table.concat(missedKeys, ', ')

0 commit comments

Comments
 (0)