Fix errhand loop when debug library is unavailable;

(cherry picked from commit dacc17e1b7)
This commit is contained in:
bjorn 2024-01-24 17:54:07 -08:00
parent 8c3c0f8136
commit 1f6904c04b
1 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ local function formatTraceback(s)
end
function lovr.errhand(message)
message = 'Error:\n\n' .. tostring(message) .. formatTraceback(debug.traceback('', 4))
message = 'Error:\n\n' .. tostring(message) .. formatTraceback(debug and debug.traceback('', 4) or '')
print(message)
@ -240,7 +240,7 @@ return function()
errored = true -- Ensure errhand is only called once
return lovr.errhand(...) or function() return 1 end
else
local message = tostring(...) .. formatTraceback(debug.traceback('', 2))
local message = tostring(...) .. formatTraceback(debug and debug.traceback('', 2) or '')
print('Error occurred while trying to display another error:\n' .. message)
return function() return 1 end
end