From 1f6904c04b77026e989193d301872f9079312fb6 Mon Sep 17 00:00:00 2001 From: bjorn Date: Wed, 24 Jan 2024 17:54:07 -0800 Subject: [PATCH] Fix errhand loop when debug library is unavailable; (cherry picked from commit dacc17e1b706f46f93fd484ef15d60b5a70c0e93) --- etc/boot.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/boot.lua b/etc/boot.lua index b018d724..5adc1ec8 100644 --- a/etc/boot.lua +++ b/etc/boot.lua @@ -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