From 585a075ec92cfb1fadb30b785fb0944f853d3f27 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sun, 17 Apr 2016 00:36:38 +0200 Subject: [PATCH] Closes #198 It was possible that we initiated a loop for bot that was connected, and it got disconnected shortly after, which could result in infinite loop if DistributeKeys was disabled (and nothing would change that bot to other one) --- ArchiSteamFarm/Bot.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index f977be94b..2ccdd1c70 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -777,9 +777,13 @@ namespace ArchiSteamFarm { continue; // Without changing the bot } - if (currentBot.SteamClient.IsConnected) { + if (!currentBot.SteamClient.IsConnected) { + currentBot = null; // Either bot will be changed, or loop aborted + } else { ArchiHandler.PurchaseResponseCallback result = await currentBot.ArchiHandler.RedeemKey(key).ConfigureAwait(false); - if (result != null) { + if (result == null) { + currentBot = null; // Either bot will be changed, or loop aborted + } else { switch (result.PurchaseResult) { case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.DuplicatedKey: case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.InvalidKey: