Skip to content

Commit 56898c1

Browse files
committed
attribcheck: improve robustness of warn function
1 parent 598180c commit 56898c1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/resources/filters/modules/attribcheck.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,13 @@ local BlockTypes = {
136136

137137
local function warn_conversion (expected, actual, shift, extrainfo)
138138
local dbginfo = debug.getinfo(5 + (shift or 0), 'Sln')
139-
warn(actual .. ' instead of ' .. expected .. ': ' ..
140-
(dbginfo.name or '<no name>') .. ' in ' .. dbginfo.source .. ':' ..
141-
dbginfo.currentline ..
142-
(extrainfo and '\n' .. extrainfo or ''))
139+
local dbginfostr = 'no detailed debug info available'
140+
if dbginfo then
141+
dbginfostr = (dbginfo.name or '<no name>') .. ' in ' .. dbginfo.source
142+
.. ':' .. dbginfo.currentline
143+
end
144+
warn(actual .. ' instead of ' .. expected .. ': ' .. dbginfostr
145+
.. (extrainfo and '\n' .. extrainfo or ''))
143146
return
144147
end
145148

0 commit comments

Comments
 (0)