mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Merge pull request #116 from initsuj/Indev
Fix IndexOutOfRangeException when bot is unloaded on update
This commit is contained in:
commit
f55c3f3994
1 changed files with 4 additions and 4 deletions
|
|
@ -477,18 +477,18 @@ namespace MinecraftClient
|
|||
|
||||
public void OnUpdate()
|
||||
{
|
||||
for (int i = 0; i < bots.Count; i++)
|
||||
foreach (var bot in bots.ToArray())
|
||||
{
|
||||
try
|
||||
{
|
||||
bots[i].Update();
|
||||
bots[i].ProcessQueuedText();
|
||||
bot.Update();
|
||||
bot.ProcessQueuedText();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (!(e is ThreadAbortException))
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted("§8Update: Got error from " + bots[i].ToString() + ": " + e.ToString());
|
||||
ConsoleIO.WriteLineFormatted("§8Update: Got error from " + bot.ToString() + ": " + e.ToString());
|
||||
}
|
||||
else throw; //ThreadAbortException should not be caught
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue