Don't crash when sizeUtf8Text is called on a nil

By returning a table with the right fields instead of nil.

Re #4845
This commit is contained in:
NiLuJe
2019-03-27 04:57:19 +01:00
parent abbb3ea747
commit 9be3455ccc

View File

@@ -157,7 +157,7 @@ end
function RenderText:sizeUtf8Text(x, width, face, text, kerning, bold)
if not text then
logger.warn("sizeUtf8Text called without text");
return
return { x = 0, y_top = 0, y_bottom = 0 }
end
-- may still need more adaptive pen placement when kerning,