mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Catch unicode error to prevent state crash.
This commit is contained in:
parent
aa63b19929
commit
1dbbb23ff6
2 changed files with 16 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue