Catch unicode error to prevent state crash.

This commit is contained in:
Alessandro Proto 2023-02-18 18:09:00 +01:00
parent aa63b19929
commit 1dbbb23ff6
2 changed files with 16 additions and 2 deletions

View file

@ -387,7 +387,14 @@ public class GPU : IComponent
var t = L.CheckString(4);
Utils.UnpackRGB((uint)c, out var r, out var g, out var b);
try
{
_game.Drawing.DrawString(new Vector2(x, y), t, new Color(r, g, b));
}
catch (ArgumentException ex) // UTF-16 fuckery
{
L.Error(ex.Message);
}
return 0;
}

View file

@ -316,7 +316,14 @@ internal class Term : IComponent
if (!L.IsNone(1))
str = L.ToString(1);
try
{
Write(str);
}
catch (ArgumentException ex) // UTF-16 fuckery
{
L.Error(ex.Message);
}
return 0;
}