From 8eff8439388e8a695e7adaf7e28955c6a9aade50 Mon Sep 17 00:00:00 2001 From: Madpeter Date: Mon, 27 Apr 2020 02:26:25 +0100 Subject: [PATCH] adds a check to see if the parcel dataset has loaded before processing --- Core/Commands/Parcel/GetParcelFlags.cs | 29 ++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Core/Commands/Parcel/GetParcelFlags.cs b/Core/Commands/Parcel/GetParcelFlags.cs index 00478b4..05ea234 100644 --- a/Core/Commands/Parcel/GetParcelFlags.cs +++ b/Core/Commands/Parcel/GetParcelFlags.cs @@ -55,21 +55,28 @@ namespace BSB.Commands.CMD_Parcel if (get_flags.Count > 0) { int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition); - Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid]; - StringBuilder reply = new StringBuilder(); - string addon = ""; - foreach (string cfg in get_flags) + if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true) { - if (flags.ContainsKey(cfg) == true) + Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid]; + StringBuilder reply = new StringBuilder(); + string addon = ""; + foreach (string cfg in get_flags) { - reply.Append(addon); - reply.Append(cfg); - reply.Append("="); - reply.Append(p.Flags.HasFlag(flags[cfg]).ToString()); - if(addon != ",") addon = ","; + if (flags.ContainsKey(cfg) == true) + { + reply.Append(addon); + reply.Append(cfg); + reply.Append("="); + reply.Append(p.Flags.HasFlag(flags[cfg]).ToString()); + if (addon != ",") addon = ","; + } } + return bot.GetCommandsInterface.SmartCommandReply(target, reply.ToString(), CommandName); + } + else + { + Failed("Enhance your carm"); } - return bot.GetCommandsInterface.SmartCommandReply(target, reply.ToString(), CommandName); } else {