From 6e09e7ca857ce05f3250f68ddbfbabd12a9cfcd4 Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:28:58 +0000 Subject: [PATCH] Update HomeboundService.cs correct issue of badly formatted slurls exploding --- SecondBotEvents/Services/HomeboundService.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/SecondBotEvents/Services/HomeboundService.cs b/SecondBotEvents/Services/HomeboundService.cs index 8ec6859..cb06c58 100644 --- a/SecondBotEvents/Services/HomeboundService.cs +++ b/SecondBotEvents/Services/HomeboundService.cs @@ -1,6 +1,8 @@ -using OpenMetaverse; +using Discord.Rest; +using OpenMetaverse; using SecondBotEvents.Config; using System; +using System.Linq; namespace SecondBotEvents.Services { @@ -41,6 +43,15 @@ namespace SecondBotEvents.Services } home = new SimSlURL(myConfig.GetHomeSimSlUrl()); backup = new SimSlURL(myConfig.GetBackupSimSLUrl()); + if(home.name == "null") + { + myConfig.setEnabled(false); + } + if(backup.name == "null") + { + LogFormater.Info("No backup sim was found using a default"); + backup = new SimSlURL("WELCOMEHUB/130/86/25"); + } if(UUID.TryParse(myConfig.GetAtHomeAutoSitUuid(), out sitTarget) == false) { sitTarget = UUID.Zero; @@ -328,6 +339,13 @@ namespace SecondBotEvents.Services url = url.Replace("https://", ""); // Viserion/66/166/23 string[] bits = url.Split("/"); + if(bits.Count() != 3) + { + name = "null"; + x = 0; + y = 0; + z = 0; + } name = System.Net.WebUtility.UrlDecode(bits[0]); x = int.Parse(bits[1]); y = int.Parse(bits[2]);