Skip to content

Commit 585a075

Browse files
committed
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)
1 parent 891d40a commit 585a075

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ArchiSteamFarm/Bot.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,9 +777,13 @@ private async Task<string> ResponseRedeem(ulong steamID, string message, bool va
777777
continue; // Without changing the bot
778778
}
779779

780-
if (currentBot.SteamClient.IsConnected) {
780+
if (!currentBot.SteamClient.IsConnected) {
781+
currentBot = null; // Either bot will be changed, or loop aborted
782+
} else {
781783
ArchiHandler.PurchaseResponseCallback result = await currentBot.ArchiHandler.RedeemKey(key).ConfigureAwait(false);
782-
if (result != null) {
784+
if (result == null) {
785+
currentBot = null; // Either bot will be changed, or loop aborted
786+
} else {
783787
switch (result.PurchaseResult) {
784788
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.DuplicatedKey:
785789
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.InvalidKey:

0 commit comments

Comments
 (0)