Don't crash the editor when encountering non-UTF8 text

This commit is contained in:
Jeremy Penner 2020-10-05 23:48:47 -04:00
parent 857e9dc8c5
commit 2783adc10c

View file

@ -34,8 +34,11 @@ end
function renderer.draw_text(font, text, x, y, color)
renderer.set_litecolor(color)
love.graphics.setFont(font.font)
love.graphics.print(text, x, y)
if pcall(function() love.graphics.print(text, x, y) end) then
return x + font.font:getWidth(text)
else
return x
end
end
renderer.font = {}