From 2783adc10c2f42beefdbc7f19cec8971e4e9bb80 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Mon, 5 Oct 2020 23:48:47 -0400 Subject: [PATCH] Don't crash the editor when encountering non-UTF8 text --- main.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.lua b/main.lua index 4815cf0..9515b77 100644 --- a/main.lua +++ b/main.lua @@ -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) - return x + font.font:getWidth(text) + if pcall(function() love.graphics.print(text, x, y) end) then + return x + font.font:getWidth(text) + else + return x + end end renderer.font = {}