From 2949239598492b47a05631ce308b9a72ccf96554 Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Thu, 2 Feb 2023 19:02:54 +0100 Subject: [PATCH] Bugfix crash on text too long --- Capy64/Runtime/Libraries/Machine.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Capy64/Runtime/Libraries/Machine.cs b/Capy64/Runtime/Libraries/Machine.cs index 6c5f354..1170449 100644 --- a/Capy64/Runtime/Libraries/Machine.cs +++ b/Capy64/Runtime/Libraries/Machine.cs @@ -78,7 +78,7 @@ public class Machine : IPlugin var currentTitle = Capy64.Instance.Window.Title; - if(!L.IsNoneOrNil(1)) + if (!L.IsNoneOrNil(1)) { var newTitle = L.CheckString(1); @@ -106,9 +106,20 @@ public class Machine : IPlugin var details = L.CheckString(1); var dstate = L.OptString(2, null); - Capy64.Instance.Discord.SetPresence(details, dstate); + try + { + Capy64.Instance.Discord.SetPresence(details, dstate); + L.PushBoolean(true); + } + catch (Exception e) + { + Console.Error.WriteLine(e); + L.PushBoolean(false); + } - return 0; + + + return 1; } }