Fix errhand loop when debug library is unavailable;

This commit is contained in:
bjorn 2024-01-24 17:54:07 -08:00
parent f8158744f9
commit dacc17e1b7
1 changed files with 2 additions and 2 deletions

View File

@ -194,7 +194,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)
@ -289,7 +289,7 @@ lovr.handlers = setmetatable({}, { __index = lovr })
return coroutine.create(function()
local function onerror(...)
onerror = function(...)
print('Error:\n\n' .. tostring(...) .. formatTraceback(debug.traceback('', 1)))
print('Error:\n\n' .. tostring(...) .. formatTraceback(debug and debug.traceback('', 1) or ''))
return function() return 1 end
end